From 8e3a48bc310705b19fc10c7f92d3f7c6bbd68642 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Mon, 28 Jul 2025 14:37:31 +0200 Subject: [PATCH] Update tests/test_utils_logcfg.py --- tests/test_utils_logcfg.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_utils_logcfg.py b/tests/test_utils_logcfg.py index f7cf6faa9..f995d0f3f 100644 --- a/tests/test_utils_logcfg.py +++ b/tests/test_utils_logcfg.py @@ -89,5 +89,12 @@ def test_import_logging_once_per_module(): stderr = result.stderr # Assert that each top-level import is logged only once + #for mod in ["json", "math", "io", "random"]: + # assert stderr.count(f"importing: {mod}") == 1, f"Module '{mod}' logged multiple times or missing" + + top_level_lines = [line for line in stderr.splitlines() if "test_utils_logcfg" in line] + for mod in ["json", "math", "io", "random"]: - assert stderr.count(f"importing: {mod}") == 1, f"Module '{mod}' logged multiple times or missing" + count = sum(1 for line in top_level_lines if f"importing: {mod}" in line) + assert count == 1, f"Top-level import of '{mod}' logged {count} times" +