[Zodb-checkins] CVS: ZODB3/ZEO/tests - testZEO.py:1.40
Guido van Rossum
guido@python.org
Tue, 17 Sep 2002 12:05:26 -0400
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv17688
Modified Files:
testZEO.py
Log Message:
Provide a timeout option on pollUp/pollDown, defaulting to 30 seconds.
=== ZODB3/ZEO/tests/testZEO.py 1.39 => 1.40 ===
--- ZODB3/ZEO/tests/testZEO.py:1.39 Tue Sep 17 02:11:05 2002
+++ ZODB3/ZEO/tests/testZEO.py Tue Sep 17 12:05:26 2002
@@ -279,15 +279,25 @@
pass
self.__super_tearDown()
- def pollUp(self):
+ def pollUp(self, timeout=30.0):
# Poll until we're connected
+ now = time.time()
+ giveup = now + timeout
while not self._storage.is_connected():
asyncore.poll(0.1)
+ now = time.time()
+ if now > giveup:
+ self.fail("timed out waiting for storage to connect")
- def pollDown(self):
+ def pollDown(self, timeout=30.0):
# Poll until we're disconnected
+ now = time.time()
+ giveup = now + timeout
while self._storage.is_connected():
asyncore.poll(0.1)
+ now = time.time()
+ if now > giveup:
+ self.fail("timed out waiting for storage to disconnect")
def checkMultipleAddresses(self):
for i in range(4):