Skip to content

Commit

Permalink
As propagate is set to False, a workaround is needed to pass the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willianantunes committed Apr 7, 2019
1 parent 3217e25 commit d22a49a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/tests/integration/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@
from django.test import Client


@pytest.yield_fixture
def caplog(caplog):
import logging

restore = []
for logger in logging.Logger.manager.loggerDict.values():
try:
if not logger.propagate:
logger.propagate = True
restore += [logger]
except AttributeError:
pass
yield caplog
for logger in restore:
logger.propagate = False


@pytest.mark.django_db
def test_should_log_username_when_one_logged_in_and_logged_out(caplog: LogCaptureFixture):
fake_admin_user = "fake-admin-user"
Expand Down

0 comments on commit d22a49a

Please sign in to comment.