if ENABLE_CACHING:
CACHES = get_cache()
else:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
@override_settings(CACHES={'default': {'BACKEND':
'django.core.cache.backends.dummy.DummyCache'}})
class IndexViewTests(TestCase):
}}}
The setting also seems to be correctly overriden, (django.conf.settings
contains dummy cache) but I encounter following problems:
* The context of the response is always None.
* Test which formerly passed now fail and view functions are not called.
All problems disappear when I disable caching **manually**!
This leads me to the assumption that the views are stilled cached.
The documentation says that overriding the cache should be possible and I
am not using sessions framwork.
I do not have enough knowledge of the architecture of django to do further
debugging.
--
Ticket URL: <https://code.djangoproject.com/ticket/28094>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Tim Graham):
I suspect this is not a bug but that you'll have to reinitialize the
class-based view after overriding the `CACHES` setting since it's already
been initialized with the original settings values.
If that's correct, perhaps
[https://github.com/django/django/blob/43b4a1618ed85151494d68778a1bb6304ce1cb79/docs/topics/testing/tools.txt#L1265-L1270
the documentation] could be clarified.
--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:1>
Comment (by R3turnz):
I agree with you that this could be the problem, but how do reinitialize
the settings?
--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:2>
* type: Bug => Cleanup/optimization
* component: Testing framework => Documentation
Comment:
I'm not sure if there's an elegant way for this to work.
--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:4>
* cc: Kevin Graves (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/28094#comment:5>