Changes between Initial Version and Version 1 of Ticket #36318, comment 6
- Timestamp:
- Apr 11, 2025, 11:15:00 AM (5 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36318, comment 6
initial v1 25 25 connection.savepoint_rollback(sid) 26 26 diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py 27 index 9fe8c58593..3 29f2e74c210064427 index 9fe8c58593..3e0d9965d4 100644 28 28 --- a/tests/transactions/tests.py 29 29 +++ b/tests/transactions/tests.py 30 @@ - 504,6 +504,27 @@ def test_mark_for_rollback_on_error_in_autocommit(self):31 # … and further queries work nicely.32 Reporter.objects.create()30 @@ -359,6 +359,28 @@ def test_atomic_prevents_queries_in_broken_transaction(self): 31 self.assertIsInstance(cm.exception.__cause__, IntegrityError) 32 self.assertEqual(Reporter.objects.get(pk=r1.pk).last_name, "Haddock") 33 33 34 + def test_transaction_management_cause_leak(self): 34 + def test_atomic_prevents_queries_in_broken_transaction_cause_attribution(self): 35 + # Trigger a previous atomic rollback to populate cause. 35 36 + with self.assertRaises(Exception), transaction.atomic(): 36 37 + raise Exception("First failure") … … 53 54 + self.assertEqual(str(ctx.exception.__cause__), "Second failure") 54 55 + 55 56 class NonAutocommitTests(TransactionTestCase):57 available_apps = []56 @skipIfDBFeature("atomic_transactions") 57 def test_atomic_allows_queries_after_fixing_transaction(self): 58 r1 = Reporter.objects.create(first_name="Archibald", last_name="Haddock") 58 59 }}}