diff options
| author | Tim Graham <timograham@gmail.com> | 2015-09-26 13:38:04 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-29 19:20:11 -0400 |
| commit | 59027a4cae8c5abbd0e9308d95dd6608be9199cd (patch) | |
| tree | c1a60900764f0850a870e5237c212418bab77314 /tests | |
| parent | 60fe6efe503d40f64ff597ab049952883dec8402 (diff) | |
[1.9.x] Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.
Thanks Simon Charette for the DeprecationInstanceCheck class.
Backport of 8d1a001ef6dcbbe8053da05cdb3ec99965b0953f from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/deprecation/tests.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py index 8f4ccf4eb5..6fa53a7fa0 100644 --- a/tests/deprecation/tests.py +++ b/tests/deprecation/tests.py @@ -7,7 +7,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, +) from django.utils.encoding import force_text @@ -197,3 +199,16 @@ class DeprecatingSimpleTestCaseUrls(unittest.TestCase): "SimpleTestCase.urls is deprecated and will be removed in " "Django 1.10. Use @override_settings(ROOT_URLCONF=...) " "in TempTestCase 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) |
