mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #21281 -- Made override_settings act at class level when used as a TestCase decorator.
This commit is contained in:
parent
8b77b64f1c
commit
d89f56dc4d
9 changed files with 73 additions and 27 deletions
5
tests/cache/tests.py
vendored
5
tests/cache/tests.py
vendored
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue