From 3d56f96f5fa37dbbc961b5779a909d485b045cbd Mon Sep 17 00:00:00 2001 From: tligui_y Date: Mon, 28 Jul 2025 14:59:26 +0200 Subject: [PATCH] Update tests/test_utils_logcfg.py --- tests/test_utils_logcfg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_utils_logcfg.py b/tests/test_utils_logcfg.py index 1491f2e1e..840317c54 100644 --- a/tests/test_utils_logcfg.py +++ b/tests/test_utils_logcfg.py @@ -24,8 +24,12 @@ def setup_custom_levels(): ("ENLARGE", lambda msg: log.enlarge(msg), "Please ENLARGE this!"), ]) def test_custom_log_outputs(levelname, logfunc, message, capsys): + logzero.setup_default_logger() + logcfg(levelname) + logfunc(message) captured = capsys.readouterr().err + assert message in captured, f"Expected message '{message}' not found in log" assert levelname in captured, f"Expected level '{levelname}' not present in log" @@ -65,5 +69,5 @@ def test_import_logging_once_per_module(): stderr = result.stderr for mod in ["json", "math", "io", "random"]: - count = sum(1 for line in top_level_lines if f"importing: {mod}" in line) + count = sum(1 for line in stderr if f"importing: {mod}" in line) assert count == 1, f"Expected 1 import log for '{mod}', found {count}"