From d89f56dc4d03f6bf6602536b8b62602ec0d46d2f Mon Sep 17 00:00:00 2001 From: Thomas Chaumeny Date: Sat, 18 Oct 2014 20:03:10 +0200 Subject: Fixed #21281 -- Made override_settings act at class level when used as a TestCase decorator. --- tests/cache/tests.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/cache') 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() -- cgit v1.3