Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.5.x] Fixed logging-related test failure introduced by e79b857.

Backport of 654d8e9.
  • Loading branch information...
1 parent 87f4860 commit 9a41045b77c05ea62c49e1bd6f29ebbee7f36954 @jacobian jacobian committed
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/regressiontests/logging_tests/
9 tests/regressiontests/logging_tests/
@@ -142,6 +142,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/ 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
@@ -157,6 +163,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)
def test_warnings_capture(self):
warnings.warn('Foo Deprecated', DeprecationWarning)

0 comments on commit 9a41045

Please sign in to comment.
Something went wrong with that request. Please try again.