summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-26 13:38:04 -0400
committerTim Graham <timograham@gmail.com>2015-09-29 18:31:11 -0400
commit8d1a001ef6dcbbe8053da05cdb3ec99965b0953f (patch)
tree707290d6af039eb825af8e93b3aa19df88d4e43e /tests
parentae9f9dc37f39afeaa45c646cf6eef81beffcf021 (diff)
Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.
Thanks Simon Charette for the DeprecationInstanceCheck class.
Diffstat (limited to 'tests')
-rw-r--r--tests/deprecation/tests.py17
-rw-r--r--tests/test_runner/tests.py6
2 files changed, 19 insertions, 4 deletions
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py
index e1ff2c8d2c..f50b2b624d 100644
--- a/tests/deprecation/tests.py
+++ b/tests/deprecation/tests.py
@@ -5,7 +5,9 @@ import warnings
from django.test import SimpleTestCase
from django.test.utils import reset_warning_registry
from django.utils import six
-from django.utils.deprecation import RenameMethodsBase
+from django.utils.deprecation import (
+ DeprecationInstanceCheck, RemovedInNextVersionWarning, RenameMethodsBase,
+)
class RenameManagerMethods(RenameMethodsBase):
@@ -170,3 +172,16 @@ class RenameMethodsTests(SimpleTestCase):
'`DeprecatedMixin.old` is deprecated, use `new` instead.',
'`RenamedMixin.old` is deprecated, use `new` instead.',
])
+
+
+class DeprecationInstanceCheckTest(SimpleTestCase):
+ def test_warning(self):
+ class Manager(six.with_metaclass(DeprecationInstanceCheck)):
+ alternative = 'fake.path.Foo'
+ deprecation_warning = RemovedInNextVersionWarning
+
+ msg = '`Manager` is deprecated, use `fake.path.Foo` instead.'
+ with warnings.catch_warnings():
+ warnings.simplefilter('error', category=RemovedInNextVersionWarning)
+ with self.assertRaisesMessage(RemovedInNextVersionWarning, msg):
+ isinstance(object, Manager)
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index b363514b2c..e3f4a8f4b6 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -352,9 +352,9 @@ class DeprecationDisplayTest(AdminScriptTestCase):
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 "Deprecation" to "RemovedInDjango\d+" in Django 1.11.
- six.assertRegex(self, err, r"DeprecationWarning: warning from test")
- six.assertRegex(self, err, r"DeprecationWarning: module-level warning from deprecation_app")
+ # 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']