bok_choy.py 2.19 KB
Newer Older
1 2 3
"""
Settings for bok choy tests
"""
4 5 6 7

import os
from path import path

8
CONFIG_ROOT = path(__file__).abspath().dirname()  # pylint: disable=E1120
9 10 11 12 13 14 15 16 17 18 19
TEST_ROOT = CONFIG_ROOT.dirname().dirname() / "test_root"

########################## Prod-like settings ###################################
# These should be as close as possible to the settings we use in production.
# As in prod, we read in environment and auth variables from JSON files.
# Unlike in prod, we use the JSON files stored in this repo.
# This is a convenience for ensuring (a) that we can consistently find the files
# and (b) that the files are the same in Jenkins as in local dev.
os.environ['SERVICE_VARIANT'] = 'bok_choy'
os.environ['CONFIG_ROOT'] = CONFIG_ROOT

20
from .aws import *  # pylint: disable=W0401, W0614
21 22 23 24


######################### Testing overrides ####################################

Will Daly committed
25
# Needed for the reset database management command
26 27 28 29 30 31 32 33 34 35 36 37 38 39
INSTALLED_APPS += ('django_extensions',)

# Redirect to the test_root folder within the repo
GITHUB_REPO_ROOT = (TEST_ROOT / "data").abspath()
LOG_DIR = (TEST_ROOT / "log").abspath()

# Configure Mongo modulestore to use the test folder within the repo
MONGO_MODULESTORE = MODULESTORE['default']['OPTIONS']['stores']['default']
MONGO_MODULESTORE['OPTIONS']['fs_root'] = (TEST_ROOT / "data").abspath()

# Configure XML modulestore to use test root data dir
XML_MODULESTORE = MODULESTORE['default']['OPTIONS']['stores']['xml']
XML_MODULESTORE['OPTIONS']['data_dir'] = (TEST_ROOT / "data").abspath()

40 41 42
# Configure the LMS to use our stub XQueue implementation
XQUEUE_INTERFACE['url'] = 'http://localhost:8040'

43 44 45
# Configure the LMS to use our stub ORA implementation
OPEN_ENDED_GRADING_INTERFACE['url'] = 'http://localhost:8041/'

46 47 48 49 50 51 52 53 54
# Enable django-pipeline and staticfiles
STATIC_ROOT = (TEST_ROOT / "staticfiles").abspath()
PIPELINE = True

# Silence noisy logs
import logging
LOG_OVERRIDES = [
    ('track.middleware', logging.CRITICAL),
    ('edxmako.shortcuts', logging.ERROR),
55 56
    ('dd.dogapi', logging.ERROR),
    ('edx.discussion', logging.CRITICAL),
57 58 59 60 61 62
]
for log_name, log_level in LOG_OVERRIDES:
    logging.getLogger(log_name).setLevel(log_level)

# Unfortunately, we need to use debug mode to serve staticfiles
DEBUG = True