summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2013-11-24 11:49:32 +0100
committerFlorian Apolloner <florian@apolloner.eu>2013-11-24 11:51:37 +0100
commit3ea65d1f68f9da9be51695d030349146c1ad0248 (patch)
treed75b20272c185f4da6ef3f2e346249daf29f2b95 /tests
parent7169722d5c4c9f9829e353fbeda08b7550bf8991 (diff)
Fixed regression from ffc37e2343a93cf6d44247e20cd263b41f931716.
This (hopefully) ensures that the cache are created the same way as before the offending commit.
Diffstat (limited to 'tests')
-rw-r--r--tests/cache/tests.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index d01bb634aa..25a95f81ac 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -207,9 +207,16 @@ _caches_setting_base = {
}
-def caches_setting_for_tests(**params):
- setting = dict((k, v.copy()) for k, v in _caches_setting_base.items())
- for cache_params in setting.values():
+def caches_setting_for_tests(base=None, **params):
+ # `base` is used to pull in the memcached config from the original settings,
+ # `params` are test specific overrides and `_caches_settings_base` is the
+ # base config for the tests.
+ # This results in the following search order:
+ # params -> _caches_setting_base -> base
+ base = base or {}
+ setting = dict((k, base.copy()) for k in _caches_setting_base.keys())
+ for key, cache_params in setting.items():
+ cache_params.update(_caches_setting_base[key])
cache_params.update(params)
return setting
@@ -1036,7 +1043,7 @@ for _cache_params in settings.CACHES.values():
@unittest.skipUnless(memcached_params, "memcached not available")
-@override_settings(CACHES=caches_setting_for_tests(**memcached_params))
+@override_settings(CACHES=caches_setting_for_tests(base=memcached_params))
class MemcachedCacheTests(BaseCacheTests, TestCase):
def test_invalid_keys(self):
@@ -1056,8 +1063,7 @@ class MemcachedCacheTests(BaseCacheTests, TestCase):
# Explicitly display a skipped test if no configured cache uses MemcachedCache
@unittest.skipUnless(
- any(c['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache'
- for c in settings.CACHES.values()),
+ memcached_params['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache',
"cache with python-memcached library not available")
def test_memcached_uses_highest_pickle_version(self):
# Regression test for #19810