-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add autouse fixture to not reset the root logger
- Loading branch information
1 parent
44a9dc2
commit e538093
Showing
2 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters