Loading tests/regressiontests/logging_tests/tests.py +4 −2 Original line number Diff line number Diff line Loading @@ -145,7 +145,9 @@ class WarningLoggerTests(TestCase): # If tests are invoke with "-Wall" (or any -W flag actually) then # warning logging gets disabled (see django/conf/__init__.py). However, # these tests expect warnings to be logged, so manually force warnings # to the logs. # to the logs. Use getattr() here because the logging capture state is # undocumented and (I assume) brittle. self._old_capture_state = bool(getattr(logging, '_warnings_showwarning', False)) logging.captureWarnings(True) # this convoluted setup is to avoid printing this deprecation to Loading @@ -164,7 +166,7 @@ class WarningLoggerTests(TestCase): self.logger.handlers[i].stream = self.old_streams[i] # Reset warnings state. logging.captureWarnings(False) logging.captureWarnings(self._old_capture_state) @override_settings(DEBUG=True) def test_warnings_capture(self): Loading Loading
tests/regressiontests/logging_tests/tests.py +4 −2 Original line number Diff line number Diff line Loading @@ -145,7 +145,9 @@ class WarningLoggerTests(TestCase): # If tests are invoke with "-Wall" (or any -W flag actually) then # warning logging gets disabled (see django/conf/__init__.py). However, # these tests expect warnings to be logged, so manually force warnings # to the logs. # to the logs. Use getattr() here because the logging capture state is # undocumented and (I assume) brittle. self._old_capture_state = bool(getattr(logging, '_warnings_showwarning', False)) logging.captureWarnings(True) # this convoluted setup is to avoid printing this deprecation to Loading @@ -164,7 +166,7 @@ class WarningLoggerTests(TestCase): self.logger.handlers[i].stream = self.old_streams[i] # Reset warnings state. logging.captureWarnings(False) logging.captureWarnings(self._old_capture_state) @override_settings(DEBUG=True) def test_warnings_capture(self): Loading