summaryrefslogtreecommitdiff
path: root/django/test/simple.py
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:56 -0800
commitaf8e858c1596623ffcccedc57433a009455bc314 (patch)
tree401d591ee518b252a9d62757c4ad0beef38542b1 /django/test/simple.py
parent7c39e041b1e107f437f61e97a11ce9e011d9ad2b (diff)
[1.5.x] Fixed #19546 - ensure that deprecation warnings are shown during tests
refs #18985
Diffstat (limited to 'django/test/simple.py')
-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)