Advanced deprecation warnings for Django 3.2.

This commit is contained in:
Mariusz Felisiak 2020-05-04 12:07:45 +02:00
parent 4c5236ef93
commit d106d07f73
3 changed files with 17 additions and 3 deletions

View File

@ -5,14 +5,17 @@ import warnings
from asgiref.sync import sync_to_async from asgiref.sync import sync_to_async
class RemovedInNextVersionWarning(DeprecationWarning): class RemovedInDjango40Warning(DeprecationWarning):
pass pass
class RemovedInDjango40Warning(PendingDeprecationWarning): class RemovedInDjango41Warning(PendingDeprecationWarning):
pass pass
RemovedInNextVersionWarning = RemovedInDjango40Warning
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

@ -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.1:
4.1
---
See the :ref:`Django 3.2 release notes <deprecated-features-3.2>` for more
details on these changes.
.. _deprecation-removed-in-4.0: .. _deprecation-removed-in-4.0:
4.0 4.0

View File

@ -24,7 +24,9 @@ else:
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 RemovedInDjango40Warning from django.utils.deprecation import (
RemovedInDjango40Warning, RemovedInDjango41Warning,
)
from django.utils.log import DEFAULT_LOGGING from django.utils.log import DEFAULT_LOGGING
from django.utils.version import PY37 from django.utils.version import PY37
@ -38,6 +40,7 @@ else:
# 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", RemovedInDjango40Warning) warnings.simplefilter("error", RemovedInDjango40Warning)
warnings.simplefilter('error', RemovedInDjango41Warning)
# Make resource and runtime warning errors to ensure no usage of error prone # Make resource and runtime warning errors to ensure no usage of error prone
# patterns. # patterns.
warnings.simplefilter("error", ResourceWarning) warnings.simplefilter("error", ResourceWarning)