From 0abb06930fc0686cb35079934e5bb40df66f5691 Mon Sep 17 00:00:00 2001 From: Adam Chainz Date: Sun, 26 Jul 2015 17:42:21 +0100 Subject: Fixed #25176 -- Prevented TestCase.setUpTestData() exception from leaking transaction. --- django/test/testcases.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'django') 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): -- cgit v1.3