summaryrefslogtreecommitdiff
path: root/django/test/utils.py
diff options
context:
space:
mode:
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 825c6b6d3b..234f831cfe 100644
--- a/django/test/utils.py
+++ b/django/test/utils.py
@@ -347,7 +347,11 @@ class TestContextDecorator:
context = self.enable()
if self.attr_name:
setattr(inner_self, self.attr_name, context)
- decorated_setUp(inner_self)
+ try:
+ decorated_setUp(inner_self)
+ except Exception:
+ self.disable()
+ raise
def tearDown(inner_self):
decorated_tearDown(inner_self)