[Zodb-checkins] SVN: ZODB/trunk/src/Z Wait longer for a thread to do it's work to avoid a spurious test

Jim Fulton jim at zope.com
Thu Sep 9 16:03:28 EDT 2010


Log message for revision 116280:
  Wait longer for a thread to do it's work to avoid a spurious test
  failure.
  

Changed:
  U   ZODB/trunk/src/ZEO/tests/testZEO.py
  U   ZODB/trunk/src/ZODB/tests/BasicStorage.py

-=-
Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py	2010-09-09 18:48:38 UTC (rev 116279)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py	2010-09-09 20:03:27 UTC (rev 116280)
@@ -249,7 +249,7 @@
         key = '%s:%s' % (self._storage._storage, self._storage._server_addr)
         self.assertEqual(self._storage.sortKey(), key)
 
-    def _do_store_in_separate_thread(self, oid, revid):
+    def _do_store_in_separate_thread(self, oid, revid, voted):
 
         def do_store():
             store = ZEO.ClientStorage.ClientStorage(self._storage._addr)
@@ -270,7 +270,7 @@
         thread = threading.Thread(name='T2', target=do_store)
         thread.setDaemon(True)
         thread.start()
-        thread.join(.2)
+        thread.join(voted and .1 or 9)
         return thread
 
 class FullGenericTests(

Modified: ZODB/trunk/src/ZODB/tests/BasicStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/BasicStorage.py	2010-09-09 18:48:38 UTC (rev 116279)
+++ ZODB/trunk/src/ZODB/tests/BasicStorage.py	2010-09-09 20:03:27 UTC (rev 116280)
@@ -206,13 +206,13 @@
         self._storage.tpc_finish(t)
         t.commit()
 
-    def _do_store_in_separate_thread(self, oid, revid):
+    def _do_store_in_separate_thread(self, oid, revid, voted):
         # We'll run the competing trans in a separate thread:
         thread = threading.Thread(name='T2',
             target=self._dostore, args=(oid,), kwargs=dict(revid=revid))
         thread.setDaemon(True)
         thread.start()
-        thread.join(.2)
+        thread.join(.1)
         return thread
 
     def check_checkCurrentSerialInTransaction(self):
@@ -262,7 +262,7 @@
         self._storage.tpc_vote(t)
 
         # We'll run the competing trans in a separate thread:
-        thread = self._do_store_in_separate_thread(oid, tid2)
+        thread = self._do_store_in_separate_thread(oid, tid2, True)
         self._storage.tpc_finish(t)
         thread.join(1)
 
@@ -278,7 +278,7 @@
                             '\0\0\0\0\0\0\0\0', 'x', '', t)
         self._storage.checkCurrentSerialInTransaction(oid, tid3, t)
 
-        thread = self._do_store_in_separate_thread(oid, tid3)
+        thread = self._do_store_in_separate_thread(oid, tid3, False)
 
         # There are 2 possibilities:
         # 1. The store happens before this transaction completes,



More information about the Zodb-checkins mailing list