summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/cache/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index b446465d32..17d17f7fdd 100644
--- a/tests/regressiontests/cache/tests.py
+++ b/tests/regressiontests/cache/tests.py
@@ -12,6 +12,7 @@ import string
import tempfile
import time
import warnings
+import pickle
from django.conf import settings
from django.core import management
@@ -984,6 +985,18 @@ class MemcachedCacheTests(unittest.TestCase, BaseCacheTests):
# memcached limits key length to 250
self.assertRaises(Exception, self.cache.set, 'a' * 251, 'value')
+ # Explicitly display a skipped test if no configured cache uses MemcachedCache
+ @unittest.skipUnless(
+ any(cache['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache'
+ for cache in settings.CACHES.values()),
+ "cache with python-memcached library not available")
+ def test_memcached_uses_highest_pickle_version(self):
+ # Regression test for #19810
+ for cache_key, cache in settings.CACHES.items():
+ if cache['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache':
+ self.assertEqual(get_cache(cache_key)._cache.pickleProtocol,
+ pickle.HIGHEST_PROTOCOL)
+
class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
"""