[Zope3-checkins] CVS: Zope3/src/transaction/tests - test_txn.py:1.2

Jeremy Hylton jeremy@zope.com
Fri, 7 Mar 2003 18:37:43 -0500


Update of /cvs-repository/Zope3/src/transaction/tests
In directory cvs.zope.org:/tmp/cvs-serv19879/src/transaction/tests

Modified Files:
	test_txn.py 
Log Message:
Catch errors that current during 2nd phase of 2PC.

It's not clear what the right answer is here.  The implementation
aborts any remaining resource managers and hopes for the best, which
isn't very satisfying.  Perhaps the hosed feature should come back.

Add some comments about the issues involved.  Revise the tests to
cover the current behavior.


=== Zope3/src/transaction/tests/test_txn.py 1.1 => 1.2 ===
--- Zope3/src/transaction/tests/test_txn.py:1.1	Thu Mar  6 19:18:21 2003
+++ Zope3/src/transaction/tests/test_txn.py	Fri Mar  7 18:37:39 2003
@@ -80,7 +80,6 @@
         self.assertEqual(txn.status(), Status.ABORTED)
         self.assertRaises(IllegalStateError, txn.commit)
         self.assertRaises(IllegalStateError, txn.savepoint)
-        self.assertRaises(IllegalStateError, txn.abort)
 
     def testTrivialSavepoint(self):
         txn = self.manager.begin()
@@ -129,6 +128,14 @@
         self.assertRaises(AbortError, txn.commit)
         self.assertEqual(txn.status(), Status.FAILED)
         self.assertRaises(IllegalStateError, txn.commit)
+        txn.abort()
+
+    def testCommitFailure(self):
+        txn = self.manager.begin()
+        txn.join(TestDataManager())
+        txn.join(TestDataManager(fail="commit"))
+        self.assertRaises(TransactionError, txn.commit)
+        self.assertEqual(txn.status(), Status.ABORTED)
         txn.abort()
 
 class SimpleTxnTests(BaseTxnTests):