mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Merge remote-tracking branch 'ptone/18985-fix'
This commit is contained in:
commit
f6989e559c
6 changed files with 40 additions and 22 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
@ -82,6 +83,14 @@ def setup(verbosity, test_labels):
|
|||
settings.LANGUAGE_CODE = 'en'
|
||||
settings.SITE_ID = 1
|
||||
|
||||
if verbosity > 0:
|
||||
# Ensure any warnings captured to logging are piped through a verbose
|
||||
# logging handler. If any -W options were passed explicitly on command
|
||||
# line, warnings are not captured, and this has no effect.
|
||||
logger = logging.getLogger('py.warnings')
|
||||
handler = logging.StreamHandler()
|
||||
logger.addHandler(handler)
|
||||
|
||||
# Load all the ALWAYS_INSTALLED_APPS.
|
||||
get_apps()
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import warnings
|
|||
|
||||
from django.test import TestCase
|
||||
|
||||
warnings.warn("module-level warning from deprecation_app", DeprecationWarning)
|
||||
|
||||
class DummyTest(TestCase):
|
||||
def test_warn(self):
|
||||
warnings.warn("warning from test", DeprecationWarning)
|
||||
|
|
|
@ -299,7 +299,8 @@ class DeprecationDisplayTest(AdminScriptTestCase):
|
|||
def test_runner_deprecation_verbosity_default(self):
|
||||
args = ['test', '--settings=test_project.settings']
|
||||
out, err = self.run_django_admin(args)
|
||||
self.assertTrue("DeprecationWarning: warning from test" in err)
|
||||
self.assertIn("DeprecationWarning: warning from test", err)
|
||||
self.assertIn("DeprecationWarning: module-level warning from deprecation_app", err)
|
||||
|
||||
@unittest.skipIf(sys.version_info[:2] == (2, 6),
|
||||
"On Python 2.6, DeprecationWarnings are visible anyway")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue