Files
galaxy/test/unit/test_sockets.py
T
Nicola Soranzo 3d57c22b63 Fix I201 errors from flake8-import-order
Also fix Python3 compatibility.
Remove unused method
galaxy.tools.parameters.sanitize.ToolParameterSanitizer.restore_param() .
2016-11-23 18:31:04 +00:00

13 lines
280 B
Python

import socket
from galaxy.util import sockets
def test_unused_free_port_unconstrained():
port = sockets.unused_port()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# would throw exception if port was not free.
s.bind(('localhost', port))
s.close()