From 8b6d0333cf5cfefd55e36969145507bb6acfca10 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 16 Sep 2021 09:58:12 +0200 Subject: [PATCH] Advanced deprecation warnings for Django 4.1. --- django/utils/deprecation.py | 5 +---- docs/internals/deprecation.txt | 3 +++ tests/runtests.py | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py index 08f33fa7d36..f64bc3c6fb2 100644 --- a/django/utils/deprecation.py +++ b/django/utils/deprecation.py @@ -5,7 +5,7 @@ import warnings from asgiref.sync import sync_to_async -class RemovedInDjango41Warning(DeprecationWarning): +class RemovedInNextVersionWarning(DeprecationWarning): pass @@ -13,9 +13,6 @@ class RemovedInDjango50Warning(PendingDeprecationWarning): pass -RemovedInNextVersionWarning = RemovedInDjango41Warning - - 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 29af8cc7e2e..202acdf608b 100644 --- a/docs/internals/deprecation.txt +++ b/docs/internals/deprecation.txt @@ -62,6 +62,9 @@ details on these changes. * The ability to return a ``str``, rather than a ``SafeString``, when rendering an ``ErrorDict`` and ``ErrorList`` will be removed. +See the :ref:`Django 4.1 release notes ` for more +details on these changes. + .. _deprecation-removed-in-4.1: 4.1 diff --git a/tests/runtests.py b/tests/runtests.py index 7e08baa5c04..2ec5d329691 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -26,9 +26,7 @@ else: from django.test.runner import get_max_test_processes, parallel_type from django.test.selenium import SeleniumTestCaseBase from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner - from django.utils.deprecation import ( - RemovedInDjango41Warning, RemovedInDjango50Warning, - ) + from django.utils.deprecation import RemovedInDjango50Warning from django.utils.log import DEFAULT_LOGGING try: @@ -41,7 +39,6 @@ else: # Make deprecation warnings errors to ensure no usage of deprecated features. warnings.simplefilter('error', RemovedInDjango50Warning) -warnings.simplefilter('error', RemovedInDjango41Warning) # Make resource and runtime warning errors to ensure no usage of error prone # patterns. warnings.simplefilter("error", ResourceWarning)