Advanced deprecation warnings for Django 3.0.

This commit is contained in:
Tim Graham 2018-12-27 21:00:33 -05:00
parent da1de1615c
commit f5060a1385
3 changed files with 13 additions and 5 deletions

View File

@ -2,15 +2,15 @@ import inspect
import warnings import warnings
class RemovedInDjango30Warning(DeprecationWarning): class RemovedInDjango31Warning(DeprecationWarning):
pass pass
class RemovedInDjango31Warning(PendingDeprecationWarning): class RemovedInDjango40Warning(PendingDeprecationWarning):
pass pass
RemovedInNextVersionWarning = RemovedInDjango30Warning RemovedInNextVersionWarning = RemovedInDjango31Warning
class warn_about_renamed_method: class warn_about_renamed_method:

View File

@ -7,6 +7,14 @@ in a backward incompatible way, following their deprecation, as per the
:ref:`deprecation policy <internal-release-deprecation-policy>`. More details :ref:`deprecation policy <internal-release-deprecation-policy>`. More details
about each item can often be found in the release notes of two versions prior. about each item can often be found in the release notes of two versions prior.
.. _deprecation-removed-in-4.0:
4.0
---
See the :ref:`Django 3.0 release notes <deprecated-features-3.0>` for more
details on these changes.
.. _deprecation-removed-in-3.1: .. _deprecation-removed-in-3.1:
3.1 3.1

View File

@ -19,7 +19,7 @@ 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, RemovedInDjango31Warning, RemovedInDjango31Warning, RemovedInDjango40Warning,
) )
from django.utils.log import DEFAULT_LOGGING from django.utils.log import DEFAULT_LOGGING
@ -32,7 +32,7 @@ else:
warnings.filterwarnings('ignore', r'\(1003, *', category=MySQLdb.Warning) warnings.filterwarnings('ignore', r'\(1003, *', category=MySQLdb.Warning)
# 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", RemovedInDjango40Warning)
warnings.simplefilter('error', RemovedInDjango31Warning) warnings.simplefilter('error', RemovedInDjango31Warning)
# 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)