[Zodb-checkins] CVS: ZODB3/ZEO/tests - testConnection.py:1.1.2.5
Tim Peters
tim.one at comcast.net
Mon Jul 28 15:59:55 EDT 2003
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv29527/ZEO/tests
Modified Files:
Tag: ZODB3-3_1-branch
testConnection.py
Log Message:
Hacks so that Barry's enabling of the BDB connections tests also run
on Windows. This adds another "sleep loop" since the server hasn't
even started on Windows by the time some tests finish, so shutdownServer
was dying with a "Connection refused" error.
=== ZODB3/ZEO/tests/testConnection.py 1.1.2.4 => 1.1.2.5 ===
--- ZODB3/ZEO/tests/testConnection.py:1.1.2.4 Mon Jul 28 13:46:40 2003
+++ ZODB3/ZEO/tests/testConnection.py Mon Jul 28 14:59:50 2003
@@ -66,17 +66,13 @@
def getStorage(self):
return 'ZODB.FileStorage.FileStorage'
-
-class BDBConnectionTests(UnixConnectionTests):
- def getStorage(self):
- self.__bdbdir = tempfile.mktemp()
- return 'ZEO.tests.testZEO.BDBFactory'
-
-
class WindowsConnectionTests(ConnectionTests):
"""Add Windows-specific scaffolding to the generic test suite."""
+ def getStorage(self):
+ return 'ZODB.FileStorage.FileStorage'
+
def startServer(self, create=1, index=0, read_only=0, ro_svr=0,
transaction_timeout=None):
zLOG.LOG("testZEO", zLOG.INFO,
@@ -87,7 +83,7 @@
addr = self.addr[index]
args = (path, '='+str(create), '='+str(read_only))
_addr, test_addr, test_pid = forker.start_zeo_server(
- 'ZODB.FileStorage.FileStorage',
+ self.getStorage(),
args, addr, ro_svr, transaction_timeout)
self._pids.append(test_pid)
self._servers.append(test_addr)
@@ -96,11 +92,26 @@
zLOG.LOG("testZEO", zLOG.INFO, "shutdownServer(index=%d)" % index)
if self._servers[index] is not None:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect(self._servers[index])
+ for countdown in xrange(30, -1, -1):
+ try:
+ s.connect(self._servers[index])
+ break
+ except socket.error:
+ # The server may not be alive yet!
+ if countdown == 0:
+ raise
+ else:
+ time.sleep(0.5) # wait a bit and try again
s.close()
self._servers[index] = None
# XXX waitpid() isn't available until Python 2.3
time.sleep(0.5)
+
+class BDBConnectionTests(os.name == "nt" and WindowsConnectionTests
+ or UnixConnectionTests):
+ def getStorage(self):
+ self.__bdbdir = tempfile.mktemp()
+ return 'ZEO.tests.testZEO.BDBFactory'
if os.name == "posix":
test_classes = [FileStorageConnectionTests]
More information about the Zodb-checkins
mailing list