From d106d07f732013eeb4667e73fa9cfd197e1d3484 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Mon, 4 May 2020 12:07:45 +0200 Subject: [PATCH] Advanced deprecation warnings for Django 3.2. --- django/utils/deprecation.py | 7 +++++-- docs/internals/deprecation.txt | 8 ++++++++ tests/runtests.py | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py index 6336558a817..3582fcf3a31 100644 --- a/django/utils/deprecation.py +++ b/django/utils/deprecation.py @@ -5,14 +5,17 @@ import warnings from asgiref.sync import sync_to_async -class RemovedInNextVersionWarning(DeprecationWarning): +class RemovedInDjango40Warning(DeprecationWarning): pass -class RemovedInDjango40Warning(PendingDeprecationWarning): +class RemovedInDjango41Warning(PendingDeprecationWarning): pass +RemovedInNextVersionWarning = RemovedInDjango40Warning + + class warn_about_renamed_method: def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning): self.class_name = class_name diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 074345ef403..e48356bed1c 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -7,6 +7,14 @@ in a backward incompatible way, following their deprecation, as per the :ref:`deprecation policy `. More details 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 ` for more +details on these changes. + .. _deprecation-removed-in-4.0: 4.0 diff --git a/tests/runtests.py b/tests/runtests.py index 8264d406844..d79b4b393e4 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -24,7 +24,9 @@ else: from django.test.runner import default_test_processes from django.test.selenium import SeleniumTestCaseBase 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.version import PY37 @@ -38,6 +40,7 @@ else: # Make deprecation warnings errors to ensure no usage of deprecated features. warnings.simplefilter("error", RemovedInDjango40Warning) +warnings.simplefilter('error', RemovedInDjango41Warning) # Make resource and runtime warning errors to ensure no usage of error prone # patterns. warnings.simplefilter("error", ResourceWarning)