Advanced deprecation warnings for Django 3.1.

This commit is contained in:
Mariusz Felisiak 2019-09-07 19:44:23 +02:00
parent 0ddb4ebf7b
commit 9a2a12d415
3 changed files with 5 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import inspect
import warnings import warnings
class RemovedInDjango31Warning(DeprecationWarning): class RemovedInNextVersionWarning(DeprecationWarning):
pass pass
@ -10,9 +10,6 @@ class RemovedInDjango40Warning(PendingDeprecationWarning):
pass pass
RemovedInNextVersionWarning = RemovedInDjango31Warning
class warn_about_renamed_method: class warn_about_renamed_method:
def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning): def __init__(self, class_name, old_method_name, new_method_name, deprecation_warning):
self.class_name = class_name self.class_name = class_name

View File

@ -34,6 +34,9 @@ details on these changes.
* ``django.utils.http.is_safe_url()`` will be removed. * ``django.utils.http.is_safe_url()`` will be removed.
See the :ref:`Django 3.1 release notes <deprecated-features-3.1>` for more
details on these changes.
.. _deprecation-removed-in-3.1: .. _deprecation-removed-in-3.1:
3.1 3.1

View File

@ -24,9 +24,7 @@ else:
from django.test.runner import default_test_processes from django.test.runner import default_test_processes
from django.test.selenium import SeleniumTestCaseBase from django.test.selenium import SeleniumTestCaseBase
from django.test.utils import get_runner from django.test.utils import get_runner
from django.utils.deprecation import ( from django.utils.deprecation import RemovedInDjango40Warning
RemovedInDjango31Warning, RemovedInDjango40Warning,
)
from django.utils.log import DEFAULT_LOGGING from django.utils.log import DEFAULT_LOGGING
from django.utils.version import PY37 from django.utils.version import PY37
@ -40,7 +38,6 @@ else:
# Make deprecation warnings errors to ensure no usage of deprecated features. # Make deprecation warnings errors to ensure no usage of deprecated features.
warnings.simplefilter("error", RemovedInDjango40Warning) warnings.simplefilter("error", RemovedInDjango40Warning)
warnings.simplefilter('error', RemovedInDjango31Warning)
# Make runtime warning errors to ensure no usage of error prone patterns. # Make runtime warning errors to ensure no usage of error prone patterns.
warnings.simplefilter("error", RuntimeWarning) warnings.simplefilter("error", RuntimeWarning)
# Ignore known warnings in test dependencies. # Ignore known warnings in test dependencies.