[Zodb-checkins] CVS: ZODB3/ZEO/tests - testZEO.py:1.42

Guido van Rossum guido@python.org
Tue, 17 Sep 2002 12:49:56 -0400


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

Modified Files:
	testZEO.py 
Log Message:
Hm.  The _fillports() code was getting too complicated.  Simply call
randrange(25000, 30000) to get one random port each time _getAddr() is
called.


=== ZODB3/ZEO/tests/testZEO.py 1.41 => 1.42 ===
--- ZODB3/ZEO/tests/testZEO.py:1.41	Tue Sep 17 12:44:38 2002
+++ ZODB3/ZEO/tests/testZEO.py	Tue Sep 17 12:49:55 2002
@@ -204,10 +204,6 @@
     def delStorage(self):
         removefs(self.__fs_base)
 
-def _fillports(ports):
-    for i in range(200):
-        ports.append(random.randrange(25000, 30000))
-
 class ConnectionTests(StorageTestBase.StorageTestBase):
     """Tests that explicitly manage the server process.
 
@@ -217,9 +213,6 @@
 
     __super_tearDown = StorageTestBase.StorageTestBase.tearDown
 
-    ports = []
-    _fillports(ports)
-
     def setUp(self):
         """Start a ZEO server using a Unix domain socket
 
@@ -240,9 +233,7 @@
         self.addr.append(self._getAddr())
 
     def _getAddr(self):
-        if not self.ports:
-            _fillports(self.ports)
-        return 'localhost', self.ports.pop()
+        return 'localhost', random.randrange(25000, 30000)
 
     def openClientStorage(self, cache='', cache_size=200000, wait=1,
                           read_only=0, read_only_fallback=0):
@@ -485,8 +476,8 @@
         self.assert_(not self._storage.is_connected())
 
         # XXX From here on the test doesn't work yet
-##        zLOG.LOG("testZEO", zLOG.INFO, "WHY DOES THIS HANG???")
-##        self.assertRaises(Disconnected, self._dostore)
+        zLOG.LOG("testZEO", zLOG.INFO, "WHY DOES THIS HANG???")
+        self.assertRaises(Disconnected, self._dostore)
 
 ##        # Restart the server, this time read-write
 ##        self._startServer(create=0)