[Zodb-checkins] CVS: ZEO/ZEO/tests - forker.py:1.5.2.2 multi.py:1.3.2.1 speed.py:1.4.2.1 testZEO.py:1.9.2.2

Jeremy Hylton jeremy@zope.com
Thu, 23 Aug 2001 15:29:48 -0400


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

Modified Files:
      Tag: zeo-1_0-branch
	forker.py multi.py speed.py testZEO.py 
Log Message:
Remove Python 2.x-isms so that tests run under Python 1.5.2


=== ZEO/ZEO/tests/forker.py 1.5.2.1 => 1.5.2.2 ===
 
 import asyncore
-import atexit
 import os
 import profile
 import sys


=== ZEO/ZEO/tests/multi.py 1.3 => 1.3.2.1 ===
     server_pid, server = start_server(addr)
     t1 = time.time()
-    pids = [start_client(addr, client_func) for i in range(CLIENTS)]
+    pids = []
+    for i in range(CLIENTS):
+        pids.append(start_client(addr, client_func))
     for pid in pids:
         assert type(pid) == types.IntType, "invalid pid type: %s (%s)" % \
                (repr(pid), type(pid))


=== ZEO/ZEO/tests/speed.py 1.4 => 1.4.2.1 ===
     if threads > 1:
         import threading
-        l = [threading.Thread(target=work,
-                              args=(db, results, nrep, compress, data,
-                                    detailed, minimize, i))
-             for i in range(threads)]
+        l = []
+        for i in range(threads):
+            t = threading.Thread(target=work,
+                                 args=(db, results, nrep, compress, data,
+                                       detailed, minimize, i))
+            l.append(t)
         for t in l:
             t.start()
         for t in l:
@@ -263,7 +265,9 @@
         print '-'*24
     print "num\tmean\tmin\tmax"
     for r in 1, 10, 100, 1000:
-        times = [time for time, conf in results[r]]
+        times = []
+        for time, conf in results[r]:
+            times.append(time)
         t = mean(times)
         print "%d\t%.4f\t%.4f\t%.4f" % (r, t, min(times), max(times))
 


=== ZEO/ZEO/tests/testZEO.py 1.9.2.1 => 1.9.2.2 ===
     __super_tearDown = StorageTestBase.StorageTestBase.tearDown
 
-    ports = [random.randrange(25000, 30000) for i in range(200)]
+    ports = []
+    for i in range(200):
+        ports.append(random.randrange(25000, 30000))
+    del i
 
     def setUp(self):
         """Start a ZEO server using a Unix domain socket
@@ -186,7 +189,8 @@
         """
         self.running = 1
         self.__fs_base = tempfile.mktemp()
-        port = self.ports.pop()
+        port = self.ports[0]
+        del self.ports[0]
         self.addr = '', port
         pid, exit = self._startServer()
         self._pid = pid
@@ -306,9 +310,10 @@
 def makeTestSuite(testname=''):
     suite = unittest.TestSuite()
     name = 'check' + testname
+    lname = len(name)
     for klass in ZEOFileStorageTests, ConnectionTests:
         for meth in get_methods(klass):
-            if meth.startswith(name):
+            if meth[:lname] == name:
                 suite.addTest(klass(meth))
     return suite