Changes between Initial Version and Version 1 of Ticket #36318, comment 6


Ignore:
Timestamp:
Apr 11, 2025, 11:15:00 AM (5 months ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36318, comment 6

    initial v1  
    2525                             connection.savepoint_rollback(sid)
    2626diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py
    27 index 9fe8c58593..329f2e74c2 100644
     27index 9fe8c58593..3e0d9965d4 100644
    2828--- a/tests/transactions/tests.py
    2929+++ 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")
    3333
    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.
    3536+        with self.assertRaises(Exception), transaction.atomic():
    3637+            raise Exception("First failure")
     
    5354+        self.assertEqual(str(ctx.exception.__cause__), "Second failure")
    5455+
    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")
    5859}}}
Back to Top