From e39f9c503a01e1f6e9a1ac1566166060bd5ea8b9 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 15 Dec 2021 07:45:12 -0800 Subject: [PATCH] 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. --- cms/pytest.ini | 2 ++ common/lib/pytest.ini | 2 ++ common/test/pytest.ini | 2 ++ openedx/core/lib/logsettings.py | 6 +++--- setup.cfg | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cms/pytest.ini b/cms/pytest.ini index 2ef7c09ea3..14f323546b 100644 --- a/cms/pytest.ini +++ b/cms/pytest.ini @@ -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 diff --git a/common/lib/pytest.ini b/common/lib/pytest.ini index bed2897487..d169959544 100644 --- a/common/lib/pytest.ini +++ b/common/lib/pytest.ini @@ -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 diff --git a/common/test/pytest.ini b/common/test/pytest.ini index 29effd3a75..9ae1d23a98 100644 --- a/common/test/pytest.ini +++ b/common/test/pytest.ini @@ -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 diff --git a/openedx/core/lib/logsettings.py b/openedx/core/lib/logsettings.py index 6159c19778..8762147a9a 100644 --- a/openedx/core/lib/logsettings.py +++ b/openedx/core/lib/logsettings.py @@ -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) diff --git a/setup.cfg b/setup.cfg index 954ce7b818..bf7d54a3c1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 =