diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py
index 776e03c..0b850f1 100644
a
|
b
|
class CacheDBSessionTests(SessionTestsMixin, TestCase):
|
283 | 283 | |
284 | 284 | backend = CacheDBSession |
285 | 285 | |
| 286 | |
286 | 287 | # Don't need DB flushing for these tests, so can use unittest.TestCase as base class |
287 | 288 | class FileSessionTests(SessionTestsMixin, unittest.TestCase): |
288 | 289 | |
… |
… |
class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
|
320 | 321 | |
321 | 322 | backend = CacheSession |
322 | 323 | |
| 324 | CacheSessionTests = override_settings( |
| 325 | # Some tests may fail if cache is dummy backend |
| 326 | CACHES = { |
| 327 | 'default': { |
| 328 | 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', |
| 329 | }, |
| 330 | }, |
| 331 | )(CacheSessionTests) |
| 332 | |
323 | 333 | |
324 | 334 | class SessionMiddlewareTests(unittest.TestCase): |
325 | 335 | |
diff --git a/django/test/utils.py b/django/test/utils.py
index 87f2311..e938a8b 100644
a
|
b
|
class override_settings(object):
|
218 | 218 | override = OverrideSettingsHolder(settings._wrapped) |
219 | 219 | for key, new_value in self.options.items(): |
220 | 220 | setattr(override, key, new_value) |
| 221 | if 'CACHES' in self.options: |
| 222 | from django.core import cache |
| 223 | cache.cache = cache.get_cache(cache.DEFAULT_CACHE_ALIAS) |
221 | 224 | settings._wrapped = override |
222 | 225 | |
223 | 226 | def disable(self): |