[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - stress.py:1.3

Guido van Rossum guido@python.org
Mon, 21 Jan 2002 15:36:30 -0500


Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv1587

Modified Files:
	stress.py 
Log Message:
Make sure the child process doesn't raise an exception and continue
running the rest of the tests in the child.


=== StandaloneZODB/ZEO/tests/stress.py 1.2 => 1.3 ===
         return pid
     
-    storage = ClientStorage(zaddr, debug=1, min_disconnect_poll=0.5)
-    db = ZODB.DB(storage, pool_size=NUM_CONNECTIONS)
-    setup(db.open())
-    conns = []
-    conn_count = 0
+    try:
+        storage = ClientStorage(zaddr, debug=1, min_disconnect_poll=0.5)
+        db = ZODB.DB(storage, pool_size=NUM_CONNECTIONS)
+        setup(db.open())
+        conns = []
+        conn_count = 0
 
-    for i in range(NUM_CONNECTIONS):
-        c = db.open()
-        c.__count = 0
-        conns.append(c)
-        conn_count += 1
-
-    while conn_count < 25:
-        c = random.choice(conns)
-        if c.__count > NUM_TRANSACTIONS_PER_CONN:
-            conns.remove(c)
-            c.close()
-            conn_count += 1
+        for i in range(NUM_CONNECTIONS):
             c = db.open()
             c.__count = 0
             conns.append(c)
-        else:
-            c.__count += 1
-        work(c)
+            conn_count += 1
+
+        while conn_count < 25:
+            c = random.choice(conns)
+            if c.__count > NUM_TRANSACTIONS_PER_CONN:
+                conns.remove(c)
+                c.close()
+                conn_count += 1
+                c = db.open()
+                c.__count = 0
+                conns.append(c)
+            else:
+                c.__count += 1
+            work(c)
 
-    os._exit(0)
+    finally:
+        os._exit(0)
 
 if __name__ == "__main__":
     main()