Advanced deprecation warnings for Django 2.1.

This commit is contained in:
Tim Graham 2017-09-02 21:55:59 -04:00
parent 5446b72003
commit 4a461d49c7
3 changed files with 5 additions and 8 deletions

View File

@ -6,13 +6,10 @@ class RemovedInDjango30Warning(PendingDeprecationWarning):
pass pass
class RemovedInDjango21Warning(DeprecationWarning): class RemovedInNextVersionWarning(DeprecationWarning):
pass pass
RemovedInNextVersionWarning = RemovedInDjango21Warning
class warn_about_renamed_method: class warn_about_renamed_method:
def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning): def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning):
self.class_name = class_name self.class_name = class_name

View File

@ -29,6 +29,9 @@ details on these changes.
* The ``field_name`` keyword argument of ``QuerySet.earliest()`` and * The ``field_name`` keyword argument of ``QuerySet.earliest()`` and
``latest()`` will be removed. ``latest()`` will be removed.
See the :ref:`Django 2.1 release notes <deprecated-features-2.1>` for more
details on these changes.
.. _deprecation-removed-in-2.1: .. _deprecation-removed-in-2.1:
2.1 2.1

View File

@ -17,14 +17,11 @@ from django.test import TestCase, TransactionTestCase
from django.test.runner import default_test_processes from django.test.runner import default_test_processes
from django.test.selenium import SeleniumTestCaseBase from django.test.selenium import SeleniumTestCaseBase
from django.test.utils import get_runner from django.test.utils import get_runner
from django.utils.deprecation import ( from django.utils.deprecation import RemovedInDjango30Warning
RemovedInDjango21Warning, RemovedInDjango30Warning,
)
from django.utils.log import DEFAULT_LOGGING from django.utils.log import DEFAULT_LOGGING
# Make deprecation warnings errors to ensure no usage of deprecated features. # Make deprecation warnings errors to ensure no usage of deprecated features.
warnings.simplefilter("error", RemovedInDjango30Warning) warnings.simplefilter("error", RemovedInDjango30Warning)
warnings.simplefilter("error", RemovedInDjango21Warning)
# Make runtime warning errors to ensure no usage of error prone patterns. # Make runtime warning errors to ensure no usage of error prone patterns.
warnings.simplefilter("error", RuntimeWarning) warnings.simplefilter("error", RuntimeWarning)
# Ignore known warnings in test dependencies. # Ignore known warnings in test dependencies.