Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Advanced deprecation warnings for 1.8.

  • Loading branch information...
commit 232181d1c5307d9af5fc292682661e91439a9289 1 parent 74b3467
@aaugustin aaugustin authored
View
8 django/test/utils.py
@@ -18,7 +18,7 @@
from django.template.loaders import cached
from django.test.signals import template_rendered, setting_changed
from django.utils import six
-from django.utils.deprecation import RemovedInDjango18Warning, RemovedInDjango19Warning
+from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
from django.utils.encoding import force_str
from django.utils.translation import deactivate
@@ -458,7 +458,7 @@ def __exit__(self, exc_type, exc_value, traceback):
class IgnoreDeprecationWarningsMixin(object):
- warning_classes = [RemovedInDjango18Warning]
+ warning_classes = [RemovedInDjango19Warning]
def setUp(self):
super(IgnoreDeprecationWarningsMixin, self).setUp()
@@ -473,11 +473,11 @@ def tearDown(self):
class IgnorePendingDeprecationWarningsMixin(IgnoreDeprecationWarningsMixin):
- warning_classes = [RemovedInDjango19Warning]
+ warning_classes = [RemovedInDjango20Warning]
class IgnoreAllDeprecationWarningsMixin(IgnoreDeprecationWarningsMixin):
- warning_classes = [RemovedInDjango19Warning, RemovedInDjango18Warning]
+ warning_classes = [RemovedInDjango20Warning, RemovedInDjango19Warning]
@contextmanager
View
6 django/utils/deprecation.py
@@ -2,15 +2,15 @@
import warnings
-class RemovedInDjango19Warning(PendingDeprecationWarning):
+class RemovedInDjango20Warning(DeprecationWarning):
pass
-class RemovedInDjango18Warning(DeprecationWarning):
+class RemovedInDjango19Warning(PendingDeprecationWarning):
pass
-RemovedInNextVersionWarning = RemovedInDjango18Warning
+RemovedInNextVersionWarning = RemovedInDjango19Warning
class warn_about_renamed_method(object):
View
4 tests/cache/tests.py
@@ -26,7 +26,7 @@
from django.template import Template
from django.template.response import TemplateResponse
from django.test import TestCase, TransactionTestCase, RequestFactory, override_settings
-from django.test.utils import IgnorePendingDeprecationWarningsMixin
+from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import six
from django.utils import timezone
from django.utils import translation
@@ -1176,7 +1176,7 @@ def test_custom_key_validation(self):
}
}
)
-class GetCacheTests(IgnorePendingDeprecationWarningsMixin, TestCase):
+class GetCacheTests(IgnoreDeprecationWarningsMixin, TestCase):
def test_simple(self):
from django.core.cache import caches, get_cache
View
3  tests/generic_inline_admin/tests.py
@@ -9,6 +9,7 @@
from django.forms.formsets import DEFAULT_MAX_NUM
from django.forms.models import ModelForm
from django.test import TestCase, override_settings
+from django.utils.deprecation import RemovedInDjango19Warning
# local test models
from .admin import MediaInline, MediaPermanentInline
@@ -376,7 +377,7 @@ def get_formsets(self, request, obj=None):
# Verify that the deprecation warning was triggered when get_formsets was called
# This verifies that we called that method.
self.assertEqual(len(w), 1)
- self.assertTrue(issubclass(w[0].category, PendingDeprecationWarning))
+ self.assertTrue(issubclass(w[0].category, RemovedInDjango19Warning))
class EpisodeAdmin(admin.ModelAdmin):
inlines = [
View
3  tests/queries/tests.py
@@ -14,6 +14,7 @@
from django.db.models.sql.datastructures import EmptyResultSet
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import str_prefix, CaptureQueriesContext
+from django.utils.deprecation import RemovedInDjango19Warning
from django.utils import six
from .models import (
@@ -1149,7 +1150,7 @@ def test_callable_args(self):
['<Tag: t1>', '<Tag: t2>', '<Tag: t3>', '<Tag: t4>', '<Tag: t5>']
)
self.assertEqual(len(w), 1)
- self.assertTrue(issubclass(w[0].category, PendingDeprecationWarning))
+ self.assertTrue(issubclass(w[0].category, RemovedInDjango19Warning))
class Queries2Tests(TestCase):
View
4 tests/runtests.py
@@ -11,13 +11,13 @@
import django
from django import contrib
-from django.utils.deprecation import RemovedInDjango18Warning, RemovedInDjango19Warning
+from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
from django.utils._os import upath
from django.utils import six
warnings.simplefilter("default", RemovedInDjango19Warning)
-warnings.simplefilter("default", RemovedInDjango18Warning)
+warnings.simplefilter("default", RemovedInDjango20Warning)
CONTRIB_MODULE_PATH = 'django.contrib'
View
6 tests/utils_tests/test_datastructures.py
@@ -6,13 +6,13 @@
import pickle
from django.test import SimpleTestCase
-from django.test.utils import IgnorePendingDeprecationWarningsMixin
+from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils.datastructures import (DictWrapper, ImmutableList,
MultiValueDict, MultiValueDictKeyError, MergeDict, SortedDict)
from django.utils import six
-class SortedDictTests(IgnorePendingDeprecationWarningsMixin, SimpleTestCase):
+class SortedDictTests(IgnoreDeprecationWarningsMixin, SimpleTestCase):
def setUp(self):
super(SortedDictTests, self).setUp()
self.d1 = SortedDict()
@@ -136,7 +136,7 @@ def test_reversed(self):
self.assertEqual(list(reversed(self.d2)), [7, 0, 9, 1])
-class MergeDictTests(IgnorePendingDeprecationWarningsMixin, SimpleTestCase):
+class MergeDictTests(IgnoreDeprecationWarningsMixin, SimpleTestCase):
def test_simple_mergedict(self):
d1 = {'chris': 'cool', 'camri': 'cute', 'cotton': 'adorable',
View
4 tests/utils_tests/test_module_loading.py
@@ -8,7 +8,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.test.utils import IgnoreDeprecationWarningsMixin, 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,
@@ -110,7 +110,7 @@ def test_deep_loader(self):
self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')
-class ModuleImportTestCase(IgnorePendingDeprecationWarningsMixin, unittest.TestCase):
+class ModuleImportTestCase(IgnoreDeprecationWarningsMixin, unittest.TestCase):
def test_import_by_path(self):
cls = import_by_path('django.utils.module_loading.import_by_path')
self.assertEqual(cls, import_by_path)
View
4 tests/utils_tests/test_tzinfo.py
@@ -6,7 +6,7 @@
import unittest
import warnings
-from django.test.utils import IgnorePendingDeprecationWarningsMixin
+from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils.deprecation import RemovedInDjango19Warning
@@ -16,7 +16,7 @@
from django.utils.tzinfo import FixedOffset, LocalTimezone
-class TzinfoTests(IgnorePendingDeprecationWarningsMixin, unittest.TestCase):
+class TzinfoTests(IgnoreDeprecationWarningsMixin, unittest.TestCase):
@classmethod
def setUpClass(cls):
Please sign in to comment.
Something went wrong with that request. Please try again.