From cfb7f99c8ecd45302acbb73ecf3ad6452db93b3e Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Wed, 9 Jul 2014 12:55:33 -0400 Subject: [PATCH] Add filter to ignore deprecation warnings by default Add filter to only show first occurance of DepWarning --- cms/envs/common.py | 5 +++++ cms/envs/test.py | 6 +++++- lms/envs/common.py | 8 +++++++- lms/envs/test.py | 7 ++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index 127550d4be..17c1c29472 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -33,6 +33,7 @@ from lms.envs.common import ( USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, BUGS_EMAIL, DOC_STORE_CONFIG, ALL_LANGUAGES, WIKI_ENABLED, MODULESTORE ) from path import path +from warnings import simplefilter from lms.envs.modulestore_settings import * from lms.lib.xblock.mixin import LmsBlockMixin @@ -182,6 +183,10 @@ XQUEUE_INTERFACE = { 'basic_auth': None, } +################################# Deprecation warnings ##################### + +# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) +simplefilter('ignore') ################################# Middleware ################################### # List of finder classes that know how to find static files in diff --git a/cms/envs/test.py b/cms/envs/test.py index 41cf90729a..480a5cd641 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -15,7 +15,7 @@ sessions. Assumes structure: from .common import * import os from path import path -from warnings import filterwarnings +from warnings import filterwarnings, simplefilter from uuid import uuid4 # import settings from LMS for consistent behavior with CMS @@ -149,6 +149,10 @@ INSTALLED_APPS += ('external_auth', ) # hide ratelimit warnings while running tests filterwarnings('ignore', message='No request passed to the backend, unable to rate-limit') +# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) +# https://docs.python.org/2/library/warnings.html#the-warnings-filter +simplefilter('ignore') # Change to "default" to see the first instance of each hit + # or "error" to convert all into errors ################################# CELERY ###################################### diff --git a/lms/envs/common.py b/lms/envs/common.py index 533337ffd3..542ec94b27 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -30,6 +30,7 @@ import imp import json from path import path +from warnings import simplefilter from .discussionsettings import * from .modulestore_settings import * @@ -760,9 +761,14 @@ MOCK_PEER_GRADING = False # Used for testing, debugging staff grading MOCK_STAFF_GRADING = False -################################# Jasmine ################################### +################################# Jasmine ################################## JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' +################################# Deprecation warnings ##################### + +# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) +simplefilter('ignore') + ################################# Waffle ################################### # Name prepended to cookies set by Waffle diff --git a/lms/envs/test.py b/lms/envs/test.py index 1b70fe0746..62b5002239 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -15,7 +15,7 @@ sessions. Assumes structure: from .common import * import os from path import path -from warnings import filterwarnings +from warnings import filterwarnings, simplefilter from uuid import uuid4 os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = 'localhost:8000-9000' @@ -179,6 +179,11 @@ SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd' # hide ratelimit warnings while running tests filterwarnings('ignore', message='No request passed to the backend, unable to rate-limit') +# Ignore deprecation warnings (so we don't clutter Jenkins builds/production) +# https://docs.python.org/2/library/warnings.html#the-warnings-filter +simplefilter('ignore') # Change to "default" to see the first instance of each hit + # or "error" to convert all into errors + ######### Third-party auth ########## FEATURES['ENABLE_THIRD_PARTY_AUTH'] = True