summaryrefslogtreecommitdiff
path: root/django/test
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2015-07-26 17:42:21 +0100
committerTim Graham <timograham@gmail.com>2015-08-01 07:33:22 -0400
commit0abb06930fc0686cb35079934e5bb40df66f5691 (patch)
treea523f5041fadd03f24384b95e6038b73538991cd /django/test
parentf4afa699b6b47e523f9e88e9637b3322f84b1103 (diff)
Fixed #25176 -- Prevented TestCase.setUpTestData() exception from leaking transaction.
Diffstat (limited to 'django/test')
-rw-r--r--django/test/testcases.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 6e16cfb247..eed67e9cda 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -1017,7 +1017,11 @@ class TestCase(TransactionTestCase):
except Exception:
cls._rollback_atomics(cls.cls_atomics)
raise
- cls.setUpTestData()
+ try:
+ cls.setUpTestData()
+ except Exception:
+ cls._rollback_atomics(cls.cls_atomics)
+ raise
@classmethod
def tearDownClass(cls):