summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-11-24 23:43:13 +0100
committerClaude Paroz <claude@2xlibre.net>2012-11-25 19:06:17 +0100
commit9f7cefd5059e78d75f1e1a852b51a6286ecec728 (patch)
tree660adf11ed87fa30cf23dff2593a6456751db29a /django/test/utils.py
parentf3a0ecc9ee0eae09d2c779a74b32cce7e38c1773 (diff)
downloaddjango-9f7cefd5059e78d75f1e1a852b51a6286ecec728.tar.gz
Fixed #18417 -- Raised exception when unittest.TestCase is decorated with override_settings
Diffstat (limited to 'django/test/utils.py')
-rw-r--r--django/test/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/test/utils.py b/django/test/utils.py
index f10d388227..99ef6b9fa2 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -188,7 +188,11 @@ class override_settings(object):
def __call__(self, test_func):
from django.test import TransactionTestCase
- if isinstance(test_func, type) and issubclass(test_func, TransactionTestCase):
+ if isinstance(test_func, type):
+ if not issubclass(test_func, TransactionTestCase):
+ raise Exception(
+ "Only subclasses of Django TransactionTestCase can be decorated "
+ "with override_settings")
original_pre_setup = test_func._pre_setup
original_post_teardown = test_func._post_teardown