Commit c140c020 authored by Guido van Rossum's avatar Guido van Rossum

In _getAddr(), when we run out of ports, refill the ports list.

Otherwise, when running the tests in an endless loop with "test.py
-L", eventually tests start failing because they're out of ports.
parent 052adbed
...@@ -204,6 +204,10 @@ class WindowsZEOFileStorageTests(WindowsGenericTests): ...@@ -204,6 +204,10 @@ class WindowsZEOFileStorageTests(WindowsGenericTests):
def delStorage(self): def delStorage(self):
removefs(self.__fs_base) removefs(self.__fs_base)
def _fillports(ports):
for i in range(200):
ports.append(random.randrange(25000, 30000))
class ConnectionTests(StorageTestBase.StorageTestBase): class ConnectionTests(StorageTestBase.StorageTestBase):
"""Tests that explicitly manage the server process. """Tests that explicitly manage the server process.
...@@ -214,9 +218,7 @@ class ConnectionTests(StorageTestBase.StorageTestBase): ...@@ -214,9 +218,7 @@ class ConnectionTests(StorageTestBase.StorageTestBase):
__super_tearDown = StorageTestBase.StorageTestBase.tearDown __super_tearDown = StorageTestBase.StorageTestBase.tearDown
ports = [] ports = []
for i in range(200): _fillports(ports)
ports.append(random.randrange(25000, 30000))
del i
def setUp(self): def setUp(self):
"""Start a ZEO server using a Unix domain socket """Start a ZEO server using a Unix domain socket
...@@ -238,6 +240,8 @@ class ConnectionTests(StorageTestBase.StorageTestBase): ...@@ -238,6 +240,8 @@ class ConnectionTests(StorageTestBase.StorageTestBase):
self.addr.append(self._getAddr()) self.addr.append(self._getAddr())
def _getAddr(self): def _getAddr(self):
if not self.ports:
_fillports(self.ports)
return 'localhost', self.ports.pop() return 'localhost', self.ports.pop()
def openClientStorage(self, cache='', cache_size=200000, wait=1, def openClientStorage(self, cache='', cache_size=200000, wait=1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment