From 630d30563ac78f0b115f97b9b9da5db29adcafc3 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Tue, 27 Oct 2020 16:23:46 -0400 Subject: [PATCH] Silence DeprecatedEdxPlatformImportWarning by default --- cms/envs/common.py | 10 ++++++++++ lms/envs/common.py | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/cms/envs/common.py b/cms/envs/common.py index 4d6122af15..10bd02be8f 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -43,6 +43,8 @@ When refering to XBlocks, we use the entry-point name. For example, import importlib.util import os import sys +import warnings + from corsheaders.defaults import default_headers as corsheaders_default_headers from datetime import timedelta import lms.envs.common @@ -115,6 +117,7 @@ from lms.envs.common import ( from path import Path as path from django.urls import reverse_lazy +from import_shims.warn import DeprecatedEdxPlatformImportWarning from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin from cms.lib.xblock.authoring_mixin import AuthoringMixin from xmodule.modulestore.edit_info import EditInfoMixin @@ -128,6 +131,13 @@ from openedx.core.release import doc_version # pylint: enable=useless-suppression +# Filter out DeprecatedEdxPlatformImportWarning instances for now. +# We will want these to be generally visible eventually, but while there +# are still a very high number of them, silencing them will be better for +# developer experience. +# See /docs/decisions/0007-sys-path-modification-removal.rst for details. +warnings.filterwarnings("ignore", category=DeprecatedEdxPlatformImportWarning) + ################ Enable credit eligibility feature #################### ENABLE_CREDIT_ELIGIBILITY = True diff --git a/lms/envs/common.py b/lms/envs/common.py index 032a9751b2..de457d9adf 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -32,6 +32,7 @@ Longer TODO: import importlib.util import sys import os +import warnings from corsheaders.defaults import default_headers as corsheaders_default_headers from path import Path as path @@ -45,6 +46,7 @@ from enterprise.constants import ( ENTERPRISE_OPERATOR_ROLE ) +from import_shims.warn import DeprecatedEdxPlatformImportWarning from openedx.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN from openedx.core.djangoapps.theming.helpers_dirs import ( get_themes_unchecked, @@ -54,6 +56,13 @@ from openedx.core.lib.derived import derived, derived_collection_entry from openedx.core.release import doc_version from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin +# Filter out DeprecatedEdxPlatformImportWarning instances for now. +# We will want these to be generally visible eventually, but while there +# are still a very high number of them, silencing them will be better for +# developer experience. +# See /docs/decisions/0007-sys-path-modification-removal.rst for details. +warnings.filterwarnings("ignore", category=DeprecatedEdxPlatformImportWarning) + ################################### FEATURES ################################### # .. setting_name: PLATFORM_NAME # .. setting_default: Your Platform Name Here