Skip to content

Commit cec28d5

Browse files
committed
fix(tests): fix CACHE_BACKEND test for Django 1.2
The format for the CACHE_BACKEND Django setting was changed in Django 1.3+ to the new dictionary-based CACHES style (which used to be a single string-based setting i.e. scheme://). This fix simply updates the CACHE_BACKEND setting in the test so it operates as expected for Django 1.2.
1 parent 4a7a4b4 commit cec28d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

djcelery/tests/test_backends/test_cache.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import timedelta
66

77
from billiard.einfo import ExceptionInfo
8+
import django
89
from django.core.cache.backends.base import InvalidCacheBackendError
910

1011
from celery import result
@@ -103,8 +104,13 @@ def test_custom_cache_backend(self):
103104
from celery import current_app
104105
prev_backend = current_app.conf.CELERY_CACHE_BACKEND
105106
prev_module = sys.modules['djcelery.backends.cache']
106-
current_app.conf.CELERY_CACHE_BACKEND = \
107-
'django.core.cache.backends.dummy.DummyCache'
107+
108+
if django.VERSION >= (1, 3):
109+
current_app.conf.CELERY_CACHE_BACKEND = \
110+
'django.core.cache.backends.dummy.DummyCache'
111+
else:
112+
# Django 1.2 used 'scheme://' style cache backends
113+
current_app.conf.CELERY_CACHE_BACKEND = 'dummy://'
108114
sys.modules.pop('djcelery.backends.cache')
109115
try:
110116
from djcelery.backends.cache import cache

0 commit comments

Comments
 (0)