Skip to content

Commit

Permalink
store_logging_stream_external test fix
Browse files Browse the repository at this point in the history
The store_logging_stream_external test installs external package
matplotlib and checks with the package properly logs to the avocado
directories. Unfortunately, this test used hardcoded line number of
matplotlib. Because of this, the test started failing when the line was
changed. This commit fixes this test by using regex instead of hardcoded
string. After this change, the test should be protected against external
changes in matplotlib package.

Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed May 20, 2024
1 parent bf9bc74 commit 8c699c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion selftests/functional/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ def check_matplotlib_logs(file_path):
self.assertTrue(os.path.exists(file_path))
with open(file_path, encoding="utf-8") as file:
stream = file.read()
self.assertIn("matplotlib __init__ L0337 DEBUG|", stream)
self.assertTrue(
re.match(r"matplotlib __init__ L[0-9]* DEBUG|", stream)
)

log_dir = os.path.join(self.tmpdir.name, "latest")
test_log_dir = os.path.join(
Expand Down

0 comments on commit 8c699c8

Please sign in to comment.