From 2732934e744890468879cf955eb6784190c87d8b Mon Sep 17 00:00:00 2001 From: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com> Date: Mon, 7 Aug 2023 22:08:00 +0500 Subject: [PATCH] fix: re-enable Django deprecation warnings (#32277) * fix: re-enable Django deprecation warnings --------- Co-authored-by: UsamaSadiq --- cms/pytest.ini | 2 -- common/test/pytest.ini | 2 -- openedx/core/lib/logsettings.py | 16 ++++++++-------- setup.cfg | 2 -- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/cms/pytest.ini b/cms/pytest.ini index add5ba084fc4..7f6e49c83e5b 100644 --- a/cms/pytest.ini +++ b/cms/pytest.ini @@ -12,8 +12,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 = envs python_classes = python_files = test.py tests.py test_*.py *_tests.py diff --git a/common/test/pytest.ini b/common/test/pytest.ini index 03991b349504..ffbe9c134ef3 100644 --- a/common/test/pytest.ini +++ b/common/test/pytest.ini @@ -11,6 +11,4 @@ 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 7e9a776fae8e..8a35865b0909 100644 --- a/openedx/core/lib/logsettings.py +++ b/openedx/core/lib/logsettings.py @@ -126,14 +126,14 @@ def log_python_warnings(): warnings.filterwarnings('ignore', 'Setting _field_data is deprecated') warnings.filterwarnings('ignore', 'Setting _field_data via the constructor is deprecated') warnings.filterwarnings('ignore', '.*unclosed.*', category=ResourceWarning) - 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 RemovedInDjango40Warning, RemovedInDjango41Warning - warnings.simplefilter('ignore', RemovedInDjango40Warning) - warnings.simplefilter('ignore', RemovedInDjango41Warning) - except ImportError: - pass + # 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 RemovedInDjango50Warning, RemovedInDjango51Warning + # warnings.simplefilter('ignore', RemovedInDjango50Warning) + # warnings.simplefilter('ignore', RemovedInDjango51Warning) + # except ImportError: + # pass logging.captureWarnings(True) diff --git a/setup.cfg b/setup.cfg index 673bfd6f61d8..fe889355a753 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,8 +12,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 junit_family = xunit2 norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/envs python_classes =