Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85e9b4d

Browse files
committed
Get rid of port_for
1 parentd9fba83 commit85e9b4d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎testgres/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
importio
77
importos
8-
importport_for
8+
importsocket
99
importsubprocess
1010
importsys
1111
importtempfile
@@ -33,7 +33,10 @@ def reserve_port():
3333
Generate a new port and add it to 'bound_ports'.
3434
"""
3535

36-
port=port_for.select_random(exclude_ports=bound_ports)
36+
s=socket.socket()
37+
s.bind(("",0))
38+
port=s.getsockname()[1]
39+
s.close()
3740
bound_ports.add(port)
3841

3942
returnport

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp