summaryrefslogtreecommitdiff
path: root/django
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:38:20 -0400
commitb46dad1befb1edd680c71f09df952245b3413f20 (patch)
tree2569259468a767336f53954d0f4323ad9ab8b3a9 /django
parent1acdb88136d6ca470e78dfff2998c3cc0795b39b (diff)
[1.8.x] Fixed #25176 -- Prevented TestCase.setUpTestData() exception from leaking transaction.
Backport of 0abb06930fc0686cb35079934e5bb40df66f5691 from master
Diffstat (limited to 'django')
-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 ecf0eda4e8..c960d88828 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -958,7 +958,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):