mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the review.
This commit is contained in:
parent
70ec4d776e
commit
210d0489c5
84 changed files with 287 additions and 189 deletions
|
@ -10,6 +10,7 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
from django.test import SimpleTestCase, modify_settings
|
||||
from django.test.utils import IgnorePendingDeprecationWarningsMixin, extend_sys_path
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango19Warning
|
||||
from django.utils.module_loading import (autodiscover_modules, import_by_path, import_string,
|
||||
module_has_submodule)
|
||||
from django.utils._os import upath
|
||||
|
@ -134,11 +135,11 @@ class ModuleImportTestCase(IgnorePendingDeprecationWarningsMixin, unittest.TestC
|
|||
|
||||
def test_import_by_path_pending_deprecation_warning(self):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter('always', category=PendingDeprecationWarning)
|
||||
warnings.simplefilter('always', category=RemovedInDjango19Warning)
|
||||
cls = import_by_path('django.utils.module_loading.import_by_path')
|
||||
self.assertEqual(cls, import_by_path)
|
||||
self.assertEqual(len(w), 1)
|
||||
self.assertTrue(issubclass(w[-1].category, PendingDeprecationWarning))
|
||||
self.assertTrue(issubclass(w[-1].category, RemovedInDjango19Warning))
|
||||
self.assertIn('deprecated', str(w[-1].message))
|
||||
|
||||
def test_import_string(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue