[Zodb-checkins] CVS: Packages/ZEO - forker.py:1.1.2.4

jeremy@digicool.com jeremy@digicool.com
Tue, 8 May 2001 16:49:01 -0400 (EDT)


Update of /cvs-repository/Packages/ZEO/tests
In directory korak:/tmp/cvs-serv13399/tests

Modified Files:
      Tag: ZEO-ZRPC-Dev
	forker.py 
Log Message:
Complicate start_zeo() to support tests where the ClientStorage
constructor raises an error.  The exception is caught and wrapped
inside a RuntimeError that also passes the exit and pid to be used to
shutdown the server.



--- Updated File forker.py in package Packages/ZEO --
--- forker.py	2001/05/07 13:12:54	1.1.2.3
+++ forker.py	2001/05/08 20:49:01	1.1.2.4
@@ -64,7 +64,8 @@
     if isinstance(addr, types.StringType):
         os.unlink(addr)
 
-def start_zeo(storage, cache=None, cleanup=None, domain="AF_INET"):
+def start_zeo(storage, cache=None, cleanup=None, domain="AF_INET",
+              storage_id="1"):
     """Setup ZEO client-server for storage.
 
     Returns a ClientStorage instance and a ZEOClientExit instance.
@@ -82,9 +83,13 @@
         raise ValueError, "bad domain: %s" % domain
 
     pid, exit = start_zeo_server(storage, addr)
-    s = ZEO.ClientStorage.ClientStorage(addr, debug=1, client=cache)
-    if hasattr(s, 'is_connected'):
-        while not s.is_connected():
-            time.sleep(0.1)
+    try:
+        s = ZEO.ClientStorage.ClientStorage(addr, storage_id,
+                                            debug=1, client=cache)
+        if hasattr(s, 'is_connected'):
+            while not s.is_connected():
+                time.sleep(0.1)
+    except Exception, err:
+        raise RuntimeError, (err, exit, pid)
     return s, exit, pid