[Zope-Checkins] CVS: StandaloneZODB/ZODB/tests - testTransaction.py:1.8

Jeremy Hylton jeremy@zope.com
Mon, 12 Aug 2002 16:00:50 -0400


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv14061

Modified Files:
	testTransaction.py 
Log Message:
Quick hack fix to these tests.  XXX I don't really understand them.

The HoserStoppage and ExceptionInTpcFinish were failing intermittently
on Windows.  I assume the problem is that a single error in tpc_finish()
can be recovered from iff the error is for the first jar.  I assume that
most of the time the error occurred after some other jar had committed.
Fixed the test by causing two different jars to fail.


=== StandaloneZODB/ZODB/tests/testTransaction.py 1.7 => 1.8 ===
--- StandaloneZODB/ZODB/tests/testTransaction.py:1.7	Mon Apr 15 14:55:11 2002
+++ StandaloneZODB/ZODB/tests/testTransaction.py	Mon Aug 12 16:00:49 2002
@@ -360,10 +360,11 @@
 
     def testExceptionInTpcFinish(self):
 
-        self.sub1._p_jar = SubTransactionJar(errors='tpc_finish')
+        for sub in self.sub1, self.sub2:
+            sub._p_jar = SubTransactionJar(errors='tpc_finish')
+            sub.modify(nojar=1)
         
         self.nosub1.modify()
-        self.sub1.modify(nojar=1)
 
         try: 
             get_transaction().commit()
@@ -543,10 +544,11 @@
     # last test, check the hosing mechanism
 
     def testHoserStoppage(self):
-
-        self.sub1._p_jar = SubTransactionJar(errors='tpc_finish')
+        # must have errors in at least two jars to guarantee a failure
+        for sub in self.sub1, self.sub2:
+            sub._p_jar = SubTransactionJar(errors='tpc_finish')
+            sub.modify(nojar=1)
         self.nosub1.modify()
-        self.sub1.modify(nojar=1)
 
         try:
             get_transaction().commit()