Skip to content

Commit

Permalink
Add autouse fixture to not reset the root logger
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill committed Mar 22, 2024
1 parent 44a9dc2 commit e538093
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/common/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest


@pytest.fixture(autouse=True)
def do_not_reset_the_root_logger(mocker):
# Some management commands suppress logging from models/package.py
# by calling logging.config.dictConfig directly which breaks the caplog
# fixture. See https://github.com/pytest-dev/pytest/discussions/11011
#
# This avoids breaking the caplog fixture when those management command
# modules are imported or called during tests.
mocker.patch("logging.config")
1 change: 0 additions & 1 deletion tests/common/test_command_import_aip.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_import_aip_command_creates_uncompressed_package(
):
mocker.patch("os.chown")
mocker.patch("pwd.getpwnam")
mocker.patch("logging.config")
call_command(
"import_aip",
"--decompress-source",
Expand Down

0 comments on commit e538093

Please sign in to comment.