Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Run memcache tests if any cache is configured

  • Loading branch information...
1 parent a9facb4 commit 27192564c3193a54165752e8803b4d7b635f9022 @claudep claudep committed
Showing with 7 additions and 3 deletions.
  1. +7 −3 tests/regressiontests/cache/
10 tests/regressiontests/cache/
@@ -932,16 +932,20 @@ def test_incr_decr_timeout(self):
# memcached backend isn't guaranteed to be available.
# To check the memcached backend, the test settings file will
-# need to contain a cache backend setting that points at
+# need to contain at least one cache backend setting that points at
# your memcache server.
- settings.CACHES[DEFAULT_CACHE_ALIAS]['BACKEND'].startswith('django.core.cache.backends.memcached.'),
+ any(cache['BACKEND'].startswith('django.core.cache.backends.memcached.')
+ for cache in settings.CACHES.values()),
"memcached not available")
class MemcachedCacheTests(unittest.TestCase, BaseCacheTests):
backend_name = 'django.core.cache.backends.memcached.MemcachedCache'
def setUp(self):
+ for cache in settings.CACHES.values():
+ if cache['BACKEND'].startswith('django.core.cache.backends.memcached.'):
+ name = cache['LOCATION']
+ break
self.cache = get_cache(self.backend_name, LOCATION=name)
self.prefix_cache = get_cache(self.backend_name, LOCATION=name, KEY_PREFIX='cacheprefix')
self.v2_cache = get_cache(self.backend_name, LOCATION=name, VERSION=2)

0 comments on commit 2719256

Please sign in to comment.
Something went wrong with that request. Please try again.