From 54b86635fb24f4a147d6267dfefb7dca1caee836 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Tue, 26 Apr 2022 21:56:52 +0200 Subject: [PATCH] tests: use simple log formatting --- tests/conftest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index d4369240feb..d2d52feb0c6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ from __future__ import annotations +import logging import os import re import shutil @@ -402,3 +403,14 @@ def _factory( @pytest.fixture def project_root() -> Path: return Path(__file__).parent.parent + + +@pytest.fixture(autouse=True) +def set_simple_log_formatter() -> None: + """ + This fixture removes any formatting added via IOFormatter. + """ + for name in logging.Logger.manager.loggerDict: + for handler in logging.getLogger(name).handlers: + # replace formatter with simple formatter for testing + handler.setFormatter(logging.Formatter(fmt="%(message)s"))