summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2013-03-27 10:20:00 -0700
committerJacob Kaplan-Moss <jacob@jacobian.org>2013-03-27 10:20:00 -0700
commit15c3906eeb827aad1fdfcb1cd58990dc56b76ae1 (patch)
tree2cd8c96db3ab3cbbd7a547d14d4fab96b0e67c4f
parent95b88fd4ece30536f331f5bba483fe9d937a73ae (diff)
parent654d8e96ae03470a603def2f79c9b8cd0f62f132 (diff)
Merge pull request #968 from jacobian/fix-warning-log-regression
Fixed logging-related test failure introduced by e79b857.
-rw-r--r--tests/logging_tests/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 7dde4b47b1..84e4319273 100644
--- a/tests/logging_tests/tests.py
+++ b/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 @@ class WarningLoggerTests(TestCase):
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)