[Zodb-checkins] CVS: Zope3/src/zodb/zeo/tests - threadtests.py:1.3

Jeremy Hylton jeremy@zope.com
Mon, 27 Jan 2003 15:09:38 -0500


Update of /cvs-repository/Zope3/src/zodb/zeo/tests
In directory cvs.zope.org:/tmp/cvs-serv29616

Modified Files:
	threadtests.py 
Log Message:
Change checkMTStores to use an explicit thread object.
Reduce the same of the large objects to make the tests go faster.


=== Zope3/src/zodb/zeo/tests/threadtests.py 1.2 => 1.3 ===
--- Zope3/src/zodb/zeo/tests/threadtests.py:1.2	Wed Dec 25 09:12:22 2002
+++ Zope3/src/zodb/zeo/tests/threadtests.py	Mon Jan 27 15:09:35 2003
@@ -89,6 +89,21 @@
         except Disconnected:
             self.gotDisconnected = 1
 
+class MTStoresThread(threading.Thread):
+
+    def __init__(self, dostore):
+        threading.Thread.__init__(self)
+        self._dostore = dostore
+        self.done = threading.Event()
+
+    def run(self):
+        objs = []
+        for i in range(10):
+            objs.append(MinPO("X" * 20000))
+            objs.append(MinPO("X"))
+        for obj in objs:
+            self._dostore(data=obj)
+        self.done.set()
 
 class ThreadTests:
     # Thread 1 should start a transaction, but not get all the way through it.
@@ -150,11 +165,12 @@
     def checkMTStores(self):
         threads = []
         for i in range(5):
-            t = threading.Thread(target=self.mtstorehelper)
+            t = MTStoresThread(self._dostore)
             threads.append(t)
             t.start()
         for t in threads:
-            t.join(30)
+            t.done.wait()
+            t.join(5)
         for i in threads:
             self.failUnless(not t.isAlive())