summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorPreston Holmes <preston@ptone.com>2013-01-02 16:00:39 -0800
committerPreston Holmes <preston@ptone.com>2013-01-09 08:19:22 -0800
commitcfa70d0c94a43d94e3ee48db87f2b88c29a862e1 (patch)
tree4600f21ce62f1b94d8264abcba2882c7fadb06bb /django
parent1884868adcc6945afaf7a96e01d35eafb623b847 (diff)
Fixed #19546 - ensure that deprecation warnings are shown during tests
refs #18985
Diffstat (limited to 'django')
-rw-r--r--django/test/simple.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/django/test/simple.py b/django/test/simple.py
index bf0219d53f..8faf1e4f93 100644
--- a/django/test/simple.py
+++ b/django/test/simple.py
@@ -1,3 +1,4 @@
+import logging
import unittest as real_unittest
from django.conf import settings
@@ -365,7 +366,19 @@ class DjangoTestSuiteRunner(object):
self.setup_test_environment()
suite = self.build_suite(test_labels, extra_tests)
old_config = self.setup_databases()
+ if self.verbosity > 0:
+ # ensure that deprecation warnings are displayed during testing
+ # the following state is assumed:
+ # logging.capturewarnings is true
+ # a "default" level warnings filter has been added for
+ # DeprecationWarning. See django.conf.LazySettings._configure_logging
+ logger = logging.getLogger('py.warnings')
+ handler = logging.StreamHandler()
+ logger.addHandler(handler)
result = self.run_suite(suite)
+ if self.verbosity > 0:
+ # remove the testing-specific handler
+ logger.removeHandler(handler)
self.teardown_databases(old_config)
self.teardown_test_environment()
return self.suite_result(suite, result)