Commit 05ca4c46 by Jesse Zoldak

Merge pull request #6343 from jzoldak/zoldak/quiet-factory-debug-msgs

Quiet factory debug msgs for troubleshooting failing lms unit tests
parents 8f6cb60c 55d7125f
...@@ -19,6 +19,15 @@ from tempfile import mkdtemp ...@@ -19,6 +19,15 @@ from tempfile import mkdtemp
from uuid import uuid4 from uuid import uuid4
from warnings import filterwarnings, simplefilter from warnings import filterwarnings, simplefilter
# Silence noisy logs to make troubleshooting easier when tests fail.
import logging
LOG_OVERRIDES = [
('factory.generate', logging.ERROR),
('factory.containers', logging.ERROR),
]
for log_name, log_level in LOG_OVERRIDES:
logging.getLogger(log_name).setLevel(log_level)
# mongo connection settings # mongo connection settings
MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017')) MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017'))
MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost') MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost')
...@@ -65,14 +74,14 @@ SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead ...@@ -65,14 +74,14 @@ SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
# Nose Test Runner # Nose Test Runner
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
_system = 'lms' _SYSTEM = 'lms'
_report_dir = REPO_ROOT / 'reports' / _system _REPORT_DIR = REPO_ROOT / 'reports' / _SYSTEM
_report_dir.makedirs_p() _REPORT_DIR.makedirs_p()
NOSE_ARGS = [ NOSE_ARGS = [
'--id-file', REPO_ROOT / '.testids' / _system / 'noseids', '--id-file', REPO_ROOT / '.testids' / _SYSTEM / 'noseids',
'--xunit-file', _report_dir / 'nosetests.xml', '--xunit-file', _REPORT_DIR / 'nosetests.xml',
] ]
# Local Directories # Local Directories
...@@ -248,9 +257,9 @@ FEATURES['ENABLE_PAYMENT_FAKE'] = True ...@@ -248,9 +257,9 @@ FEATURES['ENABLE_PAYMENT_FAKE'] = True
# the same settings, we can generate this randomly and guarantee # the same settings, we can generate this randomly and guarantee
# that they are using the same secret. # that they are using the same secret.
from random import choice from random import choice
import string from string import letters, digits, punctuation # pylint: disable=deprecated-module
RANDOM_SHARED_SECRET = ''.join( RANDOM_SHARED_SECRET = ''.join(
choice(string.letters + string.digits + string.punctuation) choice(letters + digits + punctuation)
for x in range(250) for x in range(250)
) )
...@@ -278,7 +287,7 @@ MEDIA_ROOT = TEST_ROOT / "uploads" ...@@ -278,7 +287,7 @@ MEDIA_ROOT = TEST_ROOT / "uploads"
MEDIA_URL = "/static/uploads/" MEDIA_URL = "/static/uploads/"
STATICFILES_DIRS.append(("uploads", MEDIA_ROOT)) STATICFILES_DIRS.append(("uploads", MEDIA_ROOT))
new_staticfiles_dirs = [] _NEW_STATICFILES_DIRS = []
# Strip out any static files that aren't in the repository root # Strip out any static files that aren't in the repository root
# so that the tests can run with only the edx-platform directory checked out # so that the tests can run with only the edx-platform directory checked out
for static_dir in STATICFILES_DIRS: for static_dir in STATICFILES_DIRS:
...@@ -289,8 +298,8 @@ for static_dir in STATICFILES_DIRS: ...@@ -289,8 +298,8 @@ for static_dir in STATICFILES_DIRS:
data_dir = static_dir data_dir = static_dir
if data_dir.startswith(REPO_ROOT): if data_dir.startswith(REPO_ROOT):
new_staticfiles_dirs.append(static_dir) _NEW_STATICFILES_DIRS.append(static_dir)
STATICFILES_DIRS = new_staticfiles_dirs STATICFILES_DIRS = _NEW_STATICFILES_DIRS
FILE_UPLOAD_TEMP_DIR = TEST_ROOT / "uploads" FILE_UPLOAD_TEMP_DIR = TEST_ROOT / "uploads"
FILE_UPLOAD_HANDLERS = ( FILE_UPLOAD_HANDLERS = (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment