TL;DR; How do you modify cache settings during testing? Specifically, enable/disable (by making TIMEOUT zero or non-zero).
Full question:
I had some code that looked like this:
from django.core.cache import cache
data = cache.get(key, {})
etc.
Now it looks like this:
from django.core.cache import caches
data = caches["default"].get(key, {})
etc.
The problem is that I have tests that change the TIMEOUT cache setting and then reload the
module, using six.moves.reload_module. After making the change, the reload never works. The
timeout remains the same as it is in the settings.py file.
The reason for the change is that I've been asked to use another cache (other than default) for the
caching for this section of the app. The Django docs say that "import cache" is deprecated, and
the proper way to do it since 1.7 is to use caches. We're using Django 1.8.
Has anyone found a solution for this?