Update tests/test_utils_logcfg.py
Run CI Tests / test (push) Successful in 28s

This commit is contained in:
2025-07-28 14:37:31 +02:00
parent 7241e939a3
commit 8e3a48bc31
+8 -1
View File
@@ -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"