summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorAndrew Artajos <andrew.artajos.dev@gmail.com>2015-10-08 17:05:01 +1100
committerTim Graham <timograham@gmail.com>2015-10-20 13:05:33 -0400
commit48888a1a67db0404e5a31c9ca0349984e496f26f (patch)
tree91561d241dd92724f485e187eed4e1d00fd5676d /tests/cache
parent9e3f6c7483d2362660e2bee554125d0215789d9d (diff)
Fixed #25501 -- Made the file-based cache backend use the highest pickling protocol.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index dca08ee081..e77cec9151 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -65,6 +65,11 @@ class Unpickable(object):
raise pickle.PickleError()
+class UnpicklableType(object):
+ # Unpicklable using the default pickling protocol on Python 2.
+ __slots__ = 'a',
+
+
@override_settings(CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
@@ -1221,6 +1226,10 @@ class FileBasedCacheTests(BaseCacheTests, TestCase):
cache.set('foo', 'bar')
os.path.exists(self.dirname)
+ def test_cache_write_unpickable_type(self):
+ # This fails if not using the highest pickling protocol on Python 2.
+ cache.set('unpickable', UnpicklableType())
+
@override_settings(CACHES={
'default': {