diff --git a/django/test/utils.py b/django/test/utils.py
index 805117d..7993b47 100644
a
|
b
|
class override_settings(object):
|
174 | 174 | """ |
175 | 175 | def __init__(self, **kwargs): |
176 | 176 | self.options = kwargs |
177 | | self.wrapped = settings._wrapped |
178 | 177 | |
179 | 178 | def __enter__(self): |
180 | 179 | self.enable() |
… |
… |
class override_settings(object):
|
183 | 182 | self.disable() |
184 | 183 | |
185 | 184 | def __call__(self, test_func): |
186 | | from django.test import TransactionTestCase |
187 | | if isinstance(test_func, type) and issubclass(test_func, TransactionTestCase): |
188 | | original_pre_setup = test_func._pre_setup |
189 | | original_post_teardown = test_func._post_teardown |
190 | | def _pre_setup(innerself): |
| 185 | from django.utils.unittest import TestCase |
| 186 | if isinstance(test_func, type) and issubclass(test_func, TestCase): |
| 187 | original_setUpClass = test_func.setUpClass |
| 188 | original_tearDownClass = test_func.tearDownClass |
| 189 | @classmethod |
| 190 | def setUpClass(cls): |
191 | 191 | self.enable() |
192 | | original_pre_setup(innerself) |
193 | | def _post_teardown(innerself): |
194 | | original_post_teardown(innerself) |
| 192 | original_setUpClass() |
| 193 | @classmethod |
| 194 | def tearDownClass(cls): |
| 195 | original_tearDownClass() |
195 | 196 | self.disable() |
196 | | test_func._pre_setup = _pre_setup |
197 | | test_func._post_teardown = _post_teardown |
| 197 | test_func.setUpClass = setUpClass |
| 198 | test_func.tearDownClass = tearDownClass |
198 | 199 | return test_func |
199 | 200 | else: |
200 | 201 | @wraps(test_func) |
… |
… |
class override_settings(object):
|
204 | 205 | return inner |
205 | 206 | |
206 | 207 | def enable(self): |
| 208 | self.wrapped = settings._wrapped |
207 | 209 | override = UserSettingsHolder(settings._wrapped) |
208 | 210 | for key, new_value in self.options.items(): |
209 | 211 | setattr(override, key, new_value) |