Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed logging-related test failure introduced by e79b857.

  • Loading branch information...
commit 654d8e96ae03470a603def2f79c9b8cd0f62f132 1 parent f6989e5
Jacob Kaplan-Moss authored March 27, 2013

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. 9  tests/logging_tests/tests.py
9  tests/logging_tests/tests.py
@@ -93,6 +93,12 @@ class WarningLoggerTests(TestCase):
93 93
     and captured to the logging system
94 94
     """
95 95
     def setUp(self):
  96
+        # If tests are invoke with "-Wall" (or any -W flag actually) then
  97
+        # warning logging gets disabled (see django/conf/__init__.py). However,
  98
+        # these tests expect warnings to be logged, so manually force warnings
  99
+        # to the logs.
  100
+        logging.captureWarnings(True)
  101
+
96 102
         # this convoluted setup is to avoid printing this deprecation to
97 103
         # stderr during test running - as the test runner forces deprecations
98 104
         # to be displayed at the global py.warnings level
@@ -108,6 +114,9 @@ def tearDown(self):
108 114
         for i, handler in enumerate(self.logger.handlers):
109 115
             self.logger.handlers[i].stream = self.old_streams[i]
110 116
 
  117
+        # Reset warnings state.
  118
+        logging.captureWarnings(False)
  119
+
111 120
     @override_settings(DEBUG=True)
112 121
     def test_warnings_capture(self):
113 122
         warnings.warn('Foo Deprecated', DeprecationWarning)

0 notes on commit 654d8e9

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