diff --git a/backend/tests/test_json_logging.py b/backend/tests/test_json_logging.py index cd7e07a..417d0ed 100644 --- a/backend/tests/test_json_logging.py +++ b/backend/tests/test_json_logging.py @@ -79,7 +79,9 @@ def test_root_logger_uses_json_formatter(self): root_logger = logging.getLogger() assert root_logger.handlers, "Root logger must have at least one handler" - handler = root_logger.handlers[0] - assert isinstance( - handler.formatter, JsonFormatter - ), "Root logger handler formatter must be JsonFormatter" + # Check any handler, not just [0] - pytest's logging plugin may prepend its own. + json_handlers = [ + h for h in root_logger.handlers + if isinstance(h.formatter, JsonFormatter) + ] + assert json_handlers, "At least one root logger handler must use JsonFormatter"