From 3a748cd0f53b718625d82262a70b2dabafd0185e Mon Sep 17 00:00:00 2001 From: Natalia <124304+nessita@users.noreply.github.com> Date: Fri, 3 May 2024 15:07:31 -0300 Subject: [PATCH] Advanced deprecation warnings for Django 5.2. --- django/utils/deprecation.py | 7 ++++--- docs/internals/deprecation.txt | 8 ++++++++ tests/runtests.py | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py index 4d136dfa16..9d3c628f66 100644 --- a/django/utils/deprecation.py +++ b/django/utils/deprecation.py @@ -4,15 +4,16 @@ import warnings from asgiref.sync import iscoroutinefunction, markcoroutinefunction, sync_to_async -class RemovedInNextVersionWarning(DeprecationWarning): +class RemovedInDjango60Warning(DeprecationWarning): pass -class RemovedInDjango60Warning(PendingDeprecationWarning): +class RemovedInDjango61Warning(PendingDeprecationWarning): pass -RemovedAfterNextVersionWarning = RemovedInDjango60Warning +RemovedInNextVersionWarning = RemovedInDjango60Warning +RemovedAfterNextVersionWarning = RemovedInDjango61Warning class warn_about_renamed_method: diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt index 1a74a2a46b..4b14b404fc 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-6.1: + +6.1 +--- + +See the :ref:`Django 5.2 release notes ` for more +details on these changes. + .. _deprecation-removed-in-6.0: 6.0 diff --git a/tests/runtests.py b/tests/runtests.py index 1e3d15591f..c5bb637d33 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -28,7 +28,10 @@ else: from django.test.runner import get_max_test_processes, parallel_type from django.test.selenium import SeleniumTestCase, SeleniumTestCaseBase from django.test.utils import NullTimeKeeper, TimeKeeper, get_runner - from django.utils.deprecation import RemovedInDjango60Warning + from django.utils.deprecation import ( + RemovedInDjango60Warning, + RemovedInDjango61Warning, + ) from django.utils.log import DEFAULT_LOGGING from django.utils.version import PY312, PYPY @@ -42,6 +45,7 @@ else: # Make deprecation warnings errors to ensure no usage of deprecated features. warnings.simplefilter("error", RemovedInDjango60Warning) +warnings.simplefilter("error", RemovedInDjango61Warning) # Make resource and runtime warning errors to ensure no usage of error prone # patterns. warnings.simplefilter("error", ResourceWarning)