Advanced deprecation warnings for Django 4.1.

This commit is contained in:
Mariusz Felisiak 2021-09-16 09:58:12 +02:00
parent 737fa72ae3
commit 8b6d0333cf
3 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -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 <deprecated-features-4.1>` for more
details on these changes.
.. _deprecation-removed-in-4.1:
4.1

View File

@ -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)