Don't use Redis as cache when running tests.

This commit is contained in:
Chris Church
2016-02-25 15:31:53 -05:00
parent 891e06d6ef
commit 0687168e5e
2 changed files with 16 additions and 8 deletions

View File

@@ -351,7 +351,14 @@ CELERYBEAT_SCHEDULE = {
}, },
} }
# Use Redis as cache backend. # Use Redis as cache backend (except when testing).
if is_testing():
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
}
else:
CACHES = { CACHES = {
'default': { 'default': {
'BACKEND': 'redis_cache.RedisCache', 'BACKEND': 'redis_cache.RedisCache',

View File

@@ -34,4 +34,5 @@ if not AUTH_BASIC_ENABLED:
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = [x for x in REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] if x != 'rest_framework.authentication.BasicAuthentication'] REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = [x for x in REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] if x != 'rest_framework.authentication.BasicAuthentication']
# Update cache to use celery broker URL defined in configuration files. # Update cache to use celery broker URL defined in configuration files.
if CACHES['default']['BACKEND'] == 'redis_cache.RedisCache':
CACHES['default']['LOCATION'] = BROKER_URL CACHES['default']['LOCATION'] = BROKER_URL