From 11e134c552ec540e34e2e6284dca79c6fea2d0fa Mon Sep 17 00:00:00 2001 From: Jeremy Bowman Date: Thu, 1 Feb 2018 13:00:28 -0500 Subject: [PATCH] PLAT-1916 Ignore existing usage of deprecated field_data --- cms/envs/common.py | 6 ------ cms/pytest.ini | 4 +++- common/lib/pytest.ini | 4 +++- common/test/pytest.ini | 4 +++- lms/envs/common.py | 6 ------ openedx/core/djangoapps/common_initialization/apps.py | 3 ++- openedx/core/lib/logsettings.py | 2 ++ openedx/tests/settings.py | 2 ++ setup.cfg | 4 +++- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 0ae4842b64..b650a29dca 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -132,7 +132,6 @@ from lms.envs.common import ( _make_locale_paths, ) from path import Path as path -from warnings import simplefilter from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin from cms.lib.xblock.authoring_mixin import AuthoringMixin @@ -441,11 +440,6 @@ XQUEUE_INTERFACE = { 'basic_auth': None, } -################################# Deprecation warnings ##################### - -# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) -simplefilter('ignore') - ################################# Middleware ################################### # TODO: Remove Django 1.11 upgrade shim diff --git a/cms/pytest.ini b/cms/pytest.ini index 043a960b8d..7749d15b2c 100644 --- a/cms/pytest.ini +++ b/cms/pytest.ini @@ -2,10 +2,12 @@ DJANGO_SETTINGS_MODULE = cms.envs.test addopts = --nomigrations --reuse-db --durations=20 -p no:randomly # Enable default handling for all warnings, including those that are ignored by default; -# but hide rate-limit warnings, because we deliberately don't throttle test user logins +# but hide rate-limit warnings (because we deliberately don't throttle test user logins) +# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring) filterwarnings = default ignore:No request passed to the backend, unable to rate-limit:UserWarning + ignore::xblock.exceptions.FieldDataDeprecationWarning norecursedirs = envs python_classes = python_files = tests.py test_*.py *_tests.py diff --git a/common/lib/pytest.ini b/common/lib/pytest.ini index b83ce7cd70..d8686445fd 100644 --- a/common/lib/pytest.ini +++ b/common/lib/pytest.ini @@ -2,10 +2,12 @@ DJANGO_SETTINGS_MODULE = openedx.tests.settings addopts = --nomigrations --reuse-db --durations=20 # Enable default handling for all warnings, including those that are ignored by default; -# but hide rate-limit warnings, because we deliberately don't throttle test user logins +# but hide rate-limit warnings (because we deliberately don't throttle test user logins) +# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring) filterwarnings = default ignore:No request passed to the backend, unable to rate-limit:UserWarning + ignore::xblock.exceptions.FieldDataDeprecationWarning norecursedirs = .cache python_classes = python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py diff --git a/common/test/pytest.ini b/common/test/pytest.ini index 2bbdadfc0f..20eabbe56e 100644 --- a/common/test/pytest.ini +++ b/common/test/pytest.ini @@ -1,8 +1,10 @@ [pytest] addopts = -p no:randomly --durations=20 # Enable default handling for all warnings, including those that are ignored by default; -# but hide rate-limit warnings, because we deliberately don't throttle test user logins +# but hide rate-limit warnings (because we deliberately don't throttle test user logins) +# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring) filterwarnings = default ignore:No request passed to the backend, unable to rate-limit:UserWarning + ignore::xblock.exceptions.FieldDataDeprecationWarning norecursedirs = .cache diff --git a/lms/envs/common.py b/lms/envs/common.py index 3515fd855c..3bd1614a5a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -35,7 +35,6 @@ import os import django from path import Path as path -from warnings import simplefilter from django.utils.translation import ugettext_lazy as _ from openedx.core.djangoapps.theming.helpers_dirs import ( @@ -1249,11 +1248,6 @@ FOOTER_BROWSER_CACHE_MAX_AGE = 5 * 60 # Credit api notification cache timeout CREDIT_NOTIFICATION_CACHE_TIMEOUT = 5 * 60 * 60 -################################# Deprecation warnings ##################### - -# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) -simplefilter('ignore') - ################################# Middleware ################################### # TODO: Remove Django 1.11 upgrade shim diff --git a/openedx/core/djangoapps/common_initialization/apps.py b/openedx/core/djangoapps/common_initialization/apps.py index e404068127..084cbed671 100644 --- a/openedx/core/djangoapps/common_initialization/apps.py +++ b/openedx/core/djangoapps/common_initialization/apps.py @@ -14,7 +14,8 @@ class CommonInitializationConfig(AppConfig): from . import checks self._add_mimetypes() - def _add_mimetypes(self): + @staticmethod + def _add_mimetypes(): """ Add extra mimetypes. Used in xblock_resource. """ diff --git a/openedx/core/lib/logsettings.py b/openedx/core/lib/logsettings.py index ce1cae7ddb..96df5c252a 100644 --- a/openedx/core/lib/logsettings.py +++ b/openedx/core/lib/logsettings.py @@ -115,4 +115,6 @@ def log_python_warnings(): each test case. """ warnings.simplefilter('default') + warnings.filterwarnings('ignore', 'Setting _field_data is deprecated') + warnings.filterwarnings('ignore', 'Setting _field_data via the constructor is deprecated') logging.captureWarnings(True) diff --git a/openedx/tests/settings.py b/openedx/tests/settings.py index 3b8af21a4c..0438721228 100644 --- a/openedx/tests/settings.py +++ b/openedx/tests/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', + 'django.contrib.sites', 'djcelery', 'openedx.core.djangoapps.video_config', 'openedx.core.djangoapps.video_pipeline', @@ -62,6 +63,7 @@ INSTALLED_APPS = ( 'edxval', 'courseware', 'student', + 'openedx.core.djangoapps.site_configuration', 'lms.djangoapps.certificates.apps.CertificatesConfig', 'openedx.core.djangoapps.user_api', 'course_modes.apps.CourseModesConfig', diff --git a/setup.cfg b/setup.cfg index 2d773758c1..551be673ba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,10 +18,12 @@ process-timeout=300 DJANGO_SETTINGS_MODULE = lms.envs.test addopts = --nomigrations --reuse-db --durations=20 # Enable default handling for all warnings, including those that are ignored by default; -# but hide rate-limit warnings, because we deliberately don't throttle test user logins +# but hide rate-limit warnings (because we deliberately don't throttle test user logins) +# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring) filterwarnings = default ignore:No request passed to the backend, unable to rate-limit:UserWarning + ignore::xblock.exceptions.FieldDataDeprecationWarning norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/envs python_classes = python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py