summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorThomas Chaumeny <t.chaumeny@gmail.com>2014-10-18 20:03:10 +0200
committerTim Graham <timograham@gmail.com>2014-11-03 14:14:39 -0500
commitd89f56dc4d03f6bf6602536b8b62602ec0d46d2f (patch)
treeee089210ebb576d286abbe2bee51db042ee6ee48 /tests/cache
parent8b77b64f1cf878b100d1d2001c8a73938ea3e1ed (diff)
Fixed #21281 -- Made override_settings act at class level when used as a TestCase decorator.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 3ad1979af4..c7604f131e 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -28,6 +28,7 @@ from django.middleware.csrf import CsrfViewMiddleware
from django.template import Template
from django.template.response import TemplateResponse
from django.test import TestCase, TransactionTestCase, RequestFactory, override_settings
+from django.test.signals import setting_changed
from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import six
from django.utils import timezone
@@ -1144,8 +1145,12 @@ class FileBasedCacheTests(BaseCacheTests, TestCase):
def setUp(self):
super(FileBasedCacheTests, self).setUp()
self.dirname = tempfile.mkdtemp()
+ # Caches location cannot be modified through override_settings / modify_settings,
+ # hence settings are manipulated directly here and the setting_changed signal
+ # is triggered manually.
for cache_params in settings.CACHES.values():
cache_params.update({'LOCATION': self.dirname})
+ setting_changed.send(self.__class__, setting='CACHES', enter=False)
def tearDown(self):
super(FileBasedCacheTests, self).tearDown()