Browse Source

Advanced deprecation warnings for Django 3.2.

Mariusz Felisiak 4 years ago
parent
commit
d106d07f73
3 changed files with 17 additions and 3 deletions
  1. 5 2
      django/utils/deprecation.py
  2. 8 0
      docs/internals/deprecation.txt
  3. 4 1
      tests/runtests.py

+ 5 - 2
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

+ 8 - 0
docs/internals/deprecation.txt

@@ -7,6 +7,14 @@ in a backward incompatible way, following their deprecation, as per the
 :ref:`deprecation policy <internal-release-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 <deprecated-features-3.2>` for more
+details on these changes.
+
 .. _deprecation-removed-in-4.0:
 
 4.0

+ 4 - 1
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)