[Zope-Checkins] CVS: ZODB3/ZEO/tests - ConnectionTests.py:1.4.2.1.6.4

Jeremy Hylton jeremy@zope.com
Wed, 18 Dec 2002 11:23:54 -0500


Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv22461/tests

Modified Files:
      Tag: ZODB3-fast-restart-branch
	ConnectionTests.py 
Log Message:
Add event to TestClientStorage to wait for verification to end.


=== ZODB3/ZEO/tests/ConnectionTests.py 1.4.2.1.6.3 => 1.4.2.1.6.4 ===
--- ZODB3/ZEO/tests/ConnectionTests.py:1.4.2.1.6.3	Tue Dec 17 18:28:03 2002
+++ ZODB3/ZEO/tests/ConnectionTests.py	Wed Dec 18 11:23:54 2002
@@ -18,7 +18,8 @@
 import socket
 import sys
 import tempfile
-import thread
+import thread # XXX do we really need to catch thread.error
+import threading
 import time
 
 import zLOG
@@ -36,6 +37,11 @@
 
     def verify_cache(self, stub):
         self.verify_result = ClientStorage.verify_cache(self, stub)
+        self.end_verify = threading.Event()
+
+    def endVerify(self):
+        ClientStorage.endVerify(self)
+        self.end_verify.set()
 
 class DummyDB:
     def invalidate(self, *args, **kwargs):
@@ -604,7 +610,11 @@
 
         perstorage = self.openClientStorage(cache="test")
         self.assertEqual(perstorage.verify_result, "full verification")
-        perstorage.sync()
+        t = time.time() + 30
+        while not perstorage.end_verify.isSet():
+            perstorage.sync()
+            if time.time() > t:
+                self.fail("timed out waiting for endVerify")
 
         self.assertEqual(self._storage.load(oid, '')[1], revid)
         self.assertEqual(perstorage.load(oid, ''),