$ TEST_PORT=`python3 -m portpicker $$` && echo $TEST_PORT
12194
***
from pkg/DESCR:
This module is useful for finding unused network ports on a host.
If you need legacy Python 2 support, use the 1.3.x releases.
This module provides a pure Python pick_unused_port() function. It
can also be called via the command line for use in shell scripts.
If your code can accept a bound TCP socket rather than a port number
consider using socket.bind(('localhost', 0)) to bind atomically to
an available port rather than using this library at all.
There is a race condition between picking a port and your application
code binding to it. The use of a port server by all of your test
code to avoid that problem is recommended on loaded test hosts
running many tests at a time.
Unless you are using a port server, subsequent calls to pick_unused_port()
to obtain an additional port are not guaranteed to return a unique
port.
Github version is 1.6.0b1 which is prerelease so sticking with PYPI's 1.5.2.
`make test` output:
1 failed, 32 passed, 3 skipped in 0.60s
thanks
g
(yes, you can do this with `jot -r 1 1025 65535` in shell...)
No comments:
Post a Comment