#3012: Traceback when using locmem cache backend
--------------------------+-------------------------------------------------
Reporter: Alex Dedul | Owner: jacob
Status: reopened | Component: Cache system
Version: | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 1 | Needs_better_patch: 0
--------------------------+-------------------------------------------------
Comment (by Sundance):
Hi Gary,
I agree, the testing of all the backends instead of just the currently
configured one would be a good idea, worthy of its own ticket.
Here is a patch that adds a test for the problem reported in this here
ticket, in the meanwhile. Is this alright? I made sure that this test
fails before the bugfix is applied and passes after the bugfix is applied.
{{{
Index: tests/regressiontests/cache/tests.py
===================================================================
--- tests/regressiontests/cache/tests.py (revision 4664)
+++ tests/regressiontests/cache/tests.py (working copy)
@@ -67,5 +67,14 @@
time.sleep(2)
self.assertEqual(cache.get("expire"), None)
+ def test_unserializable_data(self):
+ # Ensure that the cache backend doesn't choke on unserializable
+ # data. (see bug #3012)
+ listiterator = iter([1, 2, 3, 4])
+ defaultvalue = "This is a default value."
+ cache.set("testiterator", listiterator)
+ cached_data = cache.get("testiterator", default=defaultvalue)
+ self.assert_(cached_data in (defaultvalue, listiterator))
+
if __name__ == '__main__':
}}}
(Note that the unit tests already failed on the locmem backend when trying
to cache a function (line 57 of tests/regressiontests/cache/tests.py), due
to the same issue as above. The bugfix patch submitted earlier also fixes
that issue.)
Did I understand correctly what was needed in terms of unit tests, Gary?
With kind regards,
-- S.
--
Ticket URL: <http://code.djangoproject.com/ticket/3012#comment:16>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---