MCPcopy Create free account
hub / github.com/Pylons/webtest / get_free_port

Function get_free_port

webtest/http.py:20–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19
20def get_free_port():
21 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
22 s.bind(('', 0))
23 ip, port = s.getsockname()
24 s.close()
25 ip = os.environ.get('WEBTEST_SERVER_BIND', '127.0.0.1')
26 return ip, port
27
28
29def check_server(host, port, path_info='/', timeout=3, retries=30):

Callers 1

createMethod · 0.85

Calls 2

closeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…