Commit 00eae372 authored by Arnaud Fontaine's avatar Arnaud Fontaine

runUnitTest: Test the full ports range as some tests require Zope to listen on...

runUnitTest: Test the full ports range as some tests require Zope to listen on a port (testShaDir...).

With erp5testnode, many tests are running concurrently on the same machine and
only 3 ports were randomly tested before continuing and thus not listening to
any port. Moreover, checking the full range (500 ports) takes less than 1ms...
parent b2429d50
...@@ -306,12 +306,11 @@ def parseListeningAddress(host_port=None, default_host='127.0.0.1'): ...@@ -306,12 +306,11 @@ def parseListeningAddress(host_port=None, default_host='127.0.0.1'):
raise RuntimeError("Can't bind to %s:%s" % host_port) raise RuntimeError("Can't bind to %s:%s" % host_port)
except ValueError: except ValueError:
default_host = host_port[1] default_host = host_port[1]
port_list = []
for i in xrange(3): for port in xrange(55000, 55500):
port_list.append(instance_random.randint(55000, 55500)) yield default_host, port
yield default_host, port_list[-1]
raise RuntimeError("Can't find free port (tried ports %s)\n" raise RuntimeError("Can't find free port (tried ports 55000 to 55500)")
% ', '.join(map(str, port_list)))
def createZServer(log=os.devnull, zserver_type='http'): def createZServer(log=os.devnull, zserver_type='http'):
import ZServer import ZServer
......
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