From 8c699c8255a88219df046063b00ab900af3011c7 Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Mon, 20 May 2024 14:44:45 +0200 Subject: [PATCH] store_logging_stream_external test fix 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 --- selftests/functional/basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selftests/functional/basic.py b/selftests/functional/basic.py index 9e53e4d832..cf47d72f10 100644 --- a/selftests/functional/basic.py +++ b/selftests/functional/basic.py @@ -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(