[Zope3-checkins] CVS: Zope3/src/zodb/zeo/tests - test_zeo.py:1.10

Barry Warsaw barry@wooz.org
Wed, 9 Apr 2003 14:32:56 -0400


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

Modified Files:
	test_zeo.py 
Log Message:
setUp(): Wrap the start_zeo_server() call in its own loop.  This
should make ECONNREFUSED errors even less likely.


=== Zope3/src/zodb/zeo/tests/test_zeo.py 1.9 => 1.10 ===
--- Zope3/src/zodb/zeo/tests/test_zeo.py:1.9	Thu Mar 13 16:32:30 2003
+++ Zope3/src/zodb/zeo/tests/test_zeo.py	Wed Apr  9 14:32:55 2003
@@ -17,11 +17,12 @@
 import os
 import sys
 import time
+import errno
 import socket
+import logging
 import asyncore
 import tempfile
 import unittest
-import logging
 
 # ZODB test support
 import zodb
@@ -99,7 +100,17 @@
 
     def setUp(self):
         logging.info("testZEO: setUp() %s", self.id())
-        zeoport, adminaddr, pid = forker.start_zeo_server(self.getConfig())
+        config = self.getConfig()
+        for i in range(10):
+            try:
+                zeoport, adminaddr, pid = forker.start_zeo_server(config)
+            except socket.error, e:
+                if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
+                    raise
+            else:
+                break
+        else:
+            raise
         self._pids = [pid]
         self._servers = [adminaddr]
         self._storage = TestClientStorage(zeoport, '1', cache_size=20000000,