#11505: Django's TestCase should reset the cache
-------------------------------------+-------------------------------------
Reporter: | Owner: andrewfong
andrewfong | Status: assigned
Type: New | Component: Testing framework
feature | Severity: Normal
Milestone: | Keywords: cache testing flush
Version: SVN | Has patch: 1
Resolution: | Needs tests: 0
Triage Stage: Accepted | Easy pickings: 0
Needs documentation: 1 |
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by jsdalton):
* cc: jim.dalton@… (added)
* needs_tests: 1 => 0
Comment:
Replying to [comment:7 julien]:
> #16401 is a duplicate and contains a much more thorough patch.
Thanks julien for consolidating the new ticket I opened back to this one.
I'm uploading the latest patch from that ticket here. In a nutshell, this
approach monkey patches cache and get_cache during test setup and keeps
track of any keys used during the test. After each test, those keys are
flushed. We also prepend '_test' to the key prefix to ensure existing
values are not overwritten. The patch is tested and working. I'm leaving
it as "needs improvement" for now mainly because there is one test in the
suite that is failing and I haven't determined why yet. It's minor
whatever is is though.
In sum, the patch works great and solves the problem. There was a bit of
discussion here about the approach, however:
https://groups.google.com/forum/#!topic/django-developers/zlaPsP13dUY .
Jacob stated he wasn't necessarily a fan of monkey patching and suggested
an alternative. I had some thoughts which I posted in response as well.
If anyone reading this comment is interested in help push this ticket
toward resolution, a great way would be to review this patch and then
weigh in on that django dev discussion. If we can reach a consensus on
django-dev I'd be happy to put in some time to implement whatever approach
is agreed upon.
--
Ticket URL: <https://code.djangoproject.com/ticket/11505#comment:10>
Django <https://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.