optimized context test time consumption (#446)

This commit is contained in:
Frank Lee
2022-03-17 14:40:52 +08:00
committed by GitHub
parent 496cbb0760
commit b72b8445c6
8 changed files with 169 additions and 357 deletions

View File

@@ -46,6 +46,7 @@ def free_port():
while True:
try:
sock = socket.socket()
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
port = random.randint(20000, 65000)
sock.bind(('localhost', port))
sock.close()