Skip to content

Commit

Permalink
tests: use simple log formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 27, 2022
1 parent 896b580 commit fafe0b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import logging
import os
import re
import shutil
Expand Down Expand Up @@ -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"))

0 comments on commit fafe0b7

Please sign in to comment.