-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
The "genio"/"log_file" is quite dangerous and requires using private members of "genio" module. Unfortunatelly "Avocado-vt" heavily depends on this so let's just fix style issues and add docstrings explaining the issues. Signed-off-by: Lukáš Doktor <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,18 +9,29 @@ | |
# | ||
# See LICENSE for more details. | ||
|
||
""" | ||
Naive module that keeps tacks of some opened files and somehow manages them. | ||
""" | ||
|
||
import os | ||
|
||
_open_log_files = {} | ||
# This variable is used from Avocado-vt | ||
_open_log_files = {} # pylint: disable=C0103 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ldoktor
Author
Contributor
|
||
|
||
|
||
def close_log_file(filename): | ||
|
||
""" | ||
This closes all files that use the same "filename" (not just path, but | ||
really just "basename(filename)". | ||
""" | ||
|
||
remove = [] | ||
for k in _open_log_files: | ||
if os.path.basename(k) == filename: | ||
f = _open_log_files[k] | ||
f.close() | ||
remove.append(k) | ||
for log_file in _open_log_files: | ||
if os.path.basename(log_file) == filename: | ||
log_fd = _open_log_files[log_file] | ||
log_fd.close() | ||
remove.append(log_file) | ||
if remove: | ||
for key_to_remove in remove: | ||
_open_log_files.pop(key_to_remove) |
Hi @ldoktor, what is the reason for this module with its private variable to be here instead of Avocado VT? From what I see not only does this introduce a lot of strange coupling between projects but it is a private module attribute that is then accessed as a global variable on the Avocado VT side. Btw I stumbled upon this while investigating the issue in avocado-framework/avocado-vt#3677 (comment). Do you happen to know more about the motivation behind this module overall?