[Zope3-checkins] CVS: Zope/lib/python/ZODB/tests - testTransaction.py:1.12.20.4

michael dunstan michael at elyt.com
Sat May 22 18:38:30 EDT 2004


Update of /cvs-repository/Zope/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv15301/lib/python/ZODB/tests

Modified Files:
      Tag: Zope-2_7-branch
	testTransaction.py 
Log Message:
     - Collector #852: Bug in the error reporting of some failure
       cases in transactions meant that the cause of the failure was
       not logged.



=== Zope/lib/python/ZODB/tests/testTransaction.py 1.12.20.3 => 1.12.20.4 ===
--- Zope/lib/python/ZODB/tests/testTransaction.py:1.12.20.3	Mon Nov 17 17:34:19 2003
+++ Zope/lib/python/ZODB/tests/testTransaction.py	Sat May 22 18:38:28 2004
@@ -337,6 +337,25 @@
         assert self.nosub1._p_jar.cabort == 1
         assert self.sub2._p_jar.cabort == 1
 
+    def testMultipleExceptionsInAbort(self):
+
+        self.sub1._p_jar = SubTransactionJar(errors='abort')
+        self.sub2._p_jar = SubTransactionJar(errors='abort')
+
+        self.nosub1.modify()
+        self.sub1.modify(nojar=1)
+        self.sub2.modify(nojar=1)
+        self.sub3.modify()
+
+        try:
+            get_transaction().abort()
+        except TestTxnException: pass
+
+        assert self.nosub1._p_jar.cabort == 1
+        assert self.sub1._p_jar.cabort == 0
+        assert self.sub2._p_jar.cabort == 0
+        assert self.sub3._p_jar.cabort == 1
+
     def testExceptionInCommit(self):
 
         self.sub1._p_jar = SubTransactionJar(errors='commit')
@@ -352,6 +371,25 @@
         assert self.nosub1._p_jar.ccommit == 1
         assert self.nosub1._p_jar.ctpc_abort == 1
         assert Transaction.hosed == 0
+
+    def testExceptionInCommitAndSubsequentAbort(self):
+
+        self.sub1._p_jar = SubTransactionJar(errors=('commit','abort'))
+
+        self.nosub1.modify()
+        self.sub1.modify(nojar=1)
+
+        try:
+            get_transaction().commit()
+        except TestTxnException: pass
+
+        assert self.nosub1._p_jar.ctpc_finish == 0
+        assert self.nosub1._p_jar.ccommit == 1
+        assert self.nosub1._p_jar.ctpc_abort == 1
+        assert self.sub1._p_jar.ccommit == 0
+        assert self.sub1._p_jar.cabort == 0
+        assert Transaction.hosed == 0
+
 
     def testExceptionInTpcVote(self):
 




More information about the Zope3-Checkins mailing list