Skip to content

Commit

Permalink
tests: ensure logging side effects are cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 26, 2022
1 parent a22b4c6 commit 22c8fe5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import importlib
import logging
import os
import re
import shutil
Expand Down Expand Up @@ -402,3 +404,15 @@ def _factory(
@pytest.fixture
def project_root() -> Path:
return Path(__file__).parent.parent


@pytest.fixture(autouse=True)
def reset_logging() -> None:
"""
This fixture ensures that any side effects introduced do to dynamic
logging configuration changes (eg: Application class), are reset.
"""
yield

logging.shutdown()
importlib.reload(logging)

0 comments on commit 22c8fe5

Please # to comment.