MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / get_random_port

Function get_random_port

tests/disposableredis/__init__.py:15–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13REDIS_SHOW_OUTPUT = int(os.environ.get('REDIS_VERBOSE', 1 if REDIS_DEBUGGER else 0))
14
15def get_random_port():
16 while True:
17 port = random.randrange(1000, 10000)
18 sock = socket.socket()
19 try:
20 sock.listen(port)
21 except Error:
22 continue
23 #_, port = sock.getsockname()
24 sock.close()
25 return port
26
27
28class Client(redis.StrictRedis):

Callers 1

startMethod · 0.70

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected