summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-01-13 19:02:39 -0500
committerTim Graham <timograham@gmail.com>2016-01-14 09:05:43 -0500
commit5b94b17feff15a9f0345f92fc0568bfe7038e3a3 (patch)
treec1dba0a0e0a3eba2ed687e04187dc4b70cae10a6 /tests
parent28acc0d6df844ccfc8de6f4e7d5883eb4841e946 (diff)
Fixed #25999 -- Removed promotion of RemovedInNextVersionWarning to loud by default.
Diffstat (limited to 'tests')
-rw-r--r--tests/logging_tests/tests.py31
-rwxr-xr-xtests/runtests.py9
-rw-r--r--tests/test_runner/tests.py28
-rw-r--r--tests/test_runner_deprecation_app/__init__.py0
-rw-r--r--tests/test_runner_deprecation_app/tests.py11
5 files changed, 0 insertions, 79 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 6cba5942b1..8864786f28 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -12,12 +12,10 @@ from django.core.files.temp import NamedTemporaryFile
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.utils import LoggingCaptureMixin, patch_logger
from django.utils.deprecation import RemovedInNextVersionWarning
-from django.utils.encoding import force_text
from django.utils.log import (
DEFAULT_LOGGING, AdminEmailHandler, CallbackFilter, RequireDebugFalse,
RequireDebugTrue,
)
-from django.utils.six import StringIO
from .logconfig import MyEmailBackend
@@ -121,40 +119,11 @@ class WarningLoggerTests(SimpleTestCase):
self._old_capture_state = bool(getattr(logging, '_warnings_showwarning', False))
logging.captureWarnings(True)
- # this convoluted setup is to avoid printing this deprecation to
- # stderr during test running - as the test runner forces deprecations
- # to be displayed at the global py.warnings level
- self.logger = logging.getLogger('py.warnings')
- self.outputs = []
- self.old_streams = []
- for handler in self.logger.handlers:
- self.old_streams.append(handler.stream)
- self.outputs.append(StringIO())
- handler.stream = self.outputs[-1]
-
def tearDown(self):
- for i, handler in enumerate(self.logger.handlers):
- self.logger.handlers[i].stream = self.old_streams[i]
-
# Reset warnings state.
logging.captureWarnings(self._old_capture_state)
@override_settings(DEBUG=True)
- def test_warnings_capture(self):
- with warnings.catch_warnings():
- warnings.filterwarnings('always')
- warnings.warn('Foo Deprecated', RemovedInNextVersionWarning)
- output = force_text(self.outputs[0].getvalue())
- self.assertIn('Foo Deprecated', output)
-
- def test_warnings_capture_debug_false(self):
- with warnings.catch_warnings():
- warnings.filterwarnings('always')
- warnings.warn('Foo Deprecated', RemovedInNextVersionWarning)
- output = force_text(self.outputs[0].getvalue())
- self.assertNotIn('Foo Deprecated', output)
-
- @override_settings(DEBUG=True)
def test_error_filter_still_raises(self):
with warnings.catch_warnings():
warnings.filterwarnings(
diff --git a/tests/runtests.py b/tests/runtests.py
index 76e1ba4406..b819262d9e 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import atexit
import copy
-import logging
import os
import shutil
import subprocess
@@ -162,14 +161,6 @@ def setup(verbosity, test_labels, parallel):
log_config['loggers']['django']['level'] = 'ERROR'
settings.LOGGING = log_config
- 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)
-
warnings.filterwarnings(
'ignore',
'The GeoManager class is deprecated.',
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index e3f4a8f4b6..8a8332093d 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -16,8 +16,6 @@ from django.test import (
)
from django.test.runner import DiscoverRunner, dependency_ordered
from django.test.testcases import connections_support_transactions
-from django.utils import six
-from django.utils.encoding import force_text
from .models import Person
@@ -337,32 +335,6 @@ class SetupDatabasesTests(unittest.TestCase):
)
-class DeprecationDisplayTest(AdminScriptTestCase):
- # tests for 19546
- def setUp(self):
- settings = {
- 'DATABASES': '{"default": {"ENGINE":"django.db.backends.sqlite3", "NAME":":memory:"}}'
- }
- self.write_settings('settings.py', sdict=settings)
-
- def tearDown(self):
- self.remove_settings('settings.py')
-
- def test_runner_deprecation_verbosity_default(self):
- args = ['test', '--settings=test_project.settings', 'test_runner_deprecation_app']
- out, err = self.run_django_admin(args)
- self.assertIn("Ran 1 test", force_text(err))
- # change "NextVersion" to "RemovedInDjango\d+" in Django 1.11.
- six.assertRegex(self, err, r"RemovedInNextVersionWarning: warning from test")
- six.assertRegex(self, err, r"RemovedInNextVersionWarning: module-level warning from deprecation_app")
-
- def test_runner_deprecation_verbosity_zero(self):
- args = ['test', '--settings=test_project.settings', '--verbosity=0', 'test_runner_deprecation_app']
- out, err = self.run_django_admin(args)
- self.assertIn("Ran 1 test", err)
- self.assertNotIn("warning from test", err)
-
-
class AutoIncrementResetTest(TransactionTestCase):
"""
Here we test creating the same model two times in different test methods,
diff --git a/tests/test_runner_deprecation_app/__init__.py b/tests/test_runner_deprecation_app/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/test_runner_deprecation_app/__init__.py
+++ /dev/null
diff --git a/tests/test_runner_deprecation_app/tests.py b/tests/test_runner_deprecation_app/tests.py
deleted file mode 100644
index 22925736fc..0000000000
--- a/tests/test_runner_deprecation_app/tests.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import warnings
-
-from django.test import TestCase
-from django.utils.deprecation import RemovedInNextVersionWarning
-
-warnings.warn("module-level warning from deprecation_app", RemovedInNextVersionWarning)
-
-
-class DummyTest(TestCase):
- def test_warn(self):
- warnings.warn("warning from test", RemovedInNextVersionWarning)