mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -13,8 +13,9 @@ from django.core.validators import ValidationError
|
||||
from django.db import connection
|
||||
from django.db.models.query import EmptyQuerySet
|
||||
from django.forms.models import model_to_dict
|
||||
from django.utils._os import upath
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
from django.utils.deprecation import RemovedInDjango18Warning
|
||||
from django.utils._os import upath
|
||||
from django.utils import six
|
||||
|
||||
from .models import (Article, ArticleStatus, BetterWriter, BigInt, Book,
|
||||
@@ -265,7 +266,7 @@ class ModelFormBaseTest(TestCase):
|
||||
|
||||
def test_missing_fields_attribute(self):
|
||||
with warnings.catch_warnings(record=True):
|
||||
warnings.simplefilter("always", DeprecationWarning)
|
||||
warnings.simplefilter("always", RemovedInDjango18Warning)
|
||||
|
||||
class MissingFieldsForm(forms.ModelForm):
|
||||
class Meta:
|
||||
@@ -275,7 +276,7 @@ class ModelFormBaseTest(TestCase):
|
||||
# if a warning has been seen already, the catch_warnings won't
|
||||
# have recorded it. The following line therefore will not work reliably:
|
||||
|
||||
# self.assertEqual(w[0].category, DeprecationWarning)
|
||||
# self.assertEqual(w[0].category, RemovedInDjango18Warning)
|
||||
|
||||
# Until end of the deprecation cycle, should still create the
|
||||
# form as before:
|
||||
|
||||
Reference in New Issue
Block a user