Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #968 from jacobian/fix-warning-log-regression

Fixed logging-related test failure introduced by e79b857.
  • Loading branch information...
commit 15c3906eeb827aad1fdfcb1cd58990dc56b76ae1 2 parents 95b88fd + 654d8e9
@jacobian jacobian authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/logging_tests/tests.py
View
9 tests/logging_tests/tests.py
@@ -93,6 +93,12 @@ class WarningLoggerTests(TestCase):
and captured to the logging system
"""
def setUp(self):
+ # 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.
+ logging.captureWarnings(True)
+
# this convoluted setup is to avoid printing this deprecation to
# stderr during test running - as the test runner forces deprecations
# to be displayed at the global py.warnings level
@@ -108,6 +114,9 @@ def tearDown(self):
for i, handler in enumerate(self.logger.handlers):
self.logger.handlers[i].stream = self.old_streams[i]
+ # Reset warnings state.
+ logging.captureWarnings(False)
+
@override_settings(DEBUG=True)
def test_warnings_capture(self):
warnings.warn('Foo Deprecated', DeprecationWarning)
Please sign in to comment.
Something went wrong with that request. Please try again.