diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index 48b330a..2b8e801 100644
a
|
b
|
|
| 1 | import logging |
1 | 2 | import sys |
2 | 3 | import os |
3 | 4 | from optparse import make_option, OptionParser |
… |
… |
from django.conf import settings
|
6 | 7 | from django.core.management.base import BaseCommand |
7 | 8 | from django.test.utils import get_runner |
8 | 9 | |
| 10 | |
9 | 11 | class Command(BaseCommand): |
10 | 12 | option_list = BaseCommand.option_list + ( |
11 | 13 | make_option('--noinput', |
… |
… |
class Command(BaseCommand):
|
57 | 59 | version=self.get_version(), |
58 | 60 | option_list=options) |
59 | 61 | |
| 62 | def execute(self, *args, **options): |
| 63 | if int(options['verbosity']) > 0: |
| 64 | # ensure that deprecation warnings are displayed during testing |
| 65 | # the following state is assumed: |
| 66 | # logging.capturewarnings is true |
| 67 | # a "default" level warnings filter has been added for |
| 68 | # DeprecationWarning. See django.conf.LazySettings._configure_logging |
| 69 | logger = logging.getLogger('py.warnings') |
| 70 | handler = logging.StreamHandler() |
| 71 | logger.addHandler(handler) |
| 72 | super(Command, self).execute(*args, **options) |
| 73 | if int(options['verbosity']) > 0: |
| 74 | # remove the testing-specific handler |
| 75 | logger.removeHandler(handler) |
| 76 | |
60 | 77 | def handle(self, *test_labels, **options): |
61 | 78 | from django.conf import settings |
62 | 79 | from django.test.utils import get_runner |
diff --git a/django/test/simple.py b/django/test/simple.py
index 8faf1e4..bf0219d 100644
a
|
b
|
|
1 | | import logging |
2 | 1 | import unittest as real_unittest |
3 | 2 | |
4 | 3 | from django.conf import settings |
… |
… |
class DjangoTestSuiteRunner(object):
|
366 | 365 | self.setup_test_environment() |
367 | 366 | suite = self.build_suite(test_labels, extra_tests) |
368 | 367 | old_config = self.setup_databases() |
369 | | if self.verbosity > 0: |
370 | | # ensure that deprecation warnings are displayed during testing |
371 | | # the following state is assumed: |
372 | | # logging.capturewarnings is true |
373 | | # a "default" level warnings filter has been added for |
374 | | # DeprecationWarning. See django.conf.LazySettings._configure_logging |
375 | | logger = logging.getLogger('py.warnings') |
376 | | handler = logging.StreamHandler() |
377 | | logger.addHandler(handler) |
378 | 368 | result = self.run_suite(suite) |
379 | | if self.verbosity > 0: |
380 | | # remove the testing-specific handler |
381 | | logger.removeHandler(handler) |
382 | 369 | self.teardown_databases(old_config) |
383 | 370 | self.teardown_test_environment() |
384 | 371 | return self.suite_result(suite, result) |
diff --git a/tests/runtests.py b/tests/runtests.py
index 8c56e27..90dc0f5 100755
a
|
b
|
|
1 | 1 | #!/usr/bin/env python |
| 2 | import logging |
2 | 3 | import os |
3 | 4 | import shutil |
4 | 5 | import subprocess |
… |
… |
def setup(verbosity, test_labels):
|
106 | 107 | # in our tests. |
107 | 108 | settings.MANAGERS = ("admin@djangoproject.com",) |
108 | 109 | |
| 110 | if verbosity > 0: |
| 111 | # Ensure py.warnings are piped through a verbose logging handler |
| 112 | logger = logging.getLogger('py.warnings') |
| 113 | handler = logging.StreamHandler() |
| 114 | logger.addHandler(handler) |
| 115 | |
109 | 116 | # Load all the ALWAYS_INSTALLED_APPS. |
110 | 117 | # (This import statement is intentionally delayed until after we |
111 | 118 | # access settings because of the USE_I18N dependency.) |