build: suppress Django deprecation warnings (#29528)

Suppress them both in tests (via setup.py and pytest.ini)
and in management command & application runs
(via logsettings.py).

Developers aren't looking at these warnings; they'll be dealt with in a
formal process for upgrading Django.  Suppress them for now so that
important information isn't lost in the noise.
This commit is contained in:
Ned Batchelder
2021-12-15 07:45:12 -08:00
committed by GitHub
parent dd610118a7
commit e39f9c503a
5 changed files with 11 additions and 3 deletions

View File

@@ -8,6 +8,8 @@ filterwarnings =
default
ignore:No request passed to the backend, unable to rate-limit:UserWarning
ignore::xblock.exceptions.FieldDataDeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango40Warning
ignore::django.utils.deprecation.RemovedInDjango41Warning
norecursedirs = envs
python_classes =
python_files = test.py tests.py test_*.py *_tests.py

View File

@@ -9,6 +9,8 @@ filterwarnings =
default
ignore:No request passed to the backend, unable to rate-limit:UserWarning
ignore::xblock.exceptions.FieldDataDeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango40Warning
ignore::django.utils.deprecation.RemovedInDjango41Warning
markers =
mongo
norecursedirs = .cache

View File

@@ -7,4 +7,6 @@ filterwarnings =
default
ignore:No request passed to the backend, unable to rate-limit:UserWarning
ignore::xblock.exceptions.FieldDataDeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango40Warning
ignore::django.utils.deprecation.RemovedInDjango41Warning
norecursedirs = .cache

View File

@@ -129,9 +129,9 @@ def log_python_warnings():
try:
# There are far too many of these deprecation warnings in startup to output for every management command;
# suppress them until we've fixed at least the most common ones as reported by the test suite
from django.utils.deprecation import RemovedInDjango20Warning, RemovedInDjango21Warning
warnings.simplefilter('ignore', RemovedInDjango20Warning)
warnings.simplefilter('ignore', RemovedInDjango21Warning)
from django.utils.deprecation import RemovedInDjango40Warning, RemovedInDjango41Warning
warnings.simplefilter('ignore', RemovedInDjango40Warning)
warnings.simplefilter('ignore', RemovedInDjango41Warning)
except ImportError:
pass
logging.captureWarnings(True)

View File

@@ -8,6 +8,8 @@ filterwarnings =
default
ignore:No request passed to the backend, unable to rate-limit:UserWarning
ignore::xblock.exceptions.FieldDataDeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango40Warning
ignore::django.utils.deprecation.RemovedInDjango41Warning
junit_family = xunit2
norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/envs
python_classes =