Skip to content

Commit

Permalink
change sample size to 100 (matches conftest) and updated error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
robnagler committed Jan 18, 2024
1 parent e776dbb commit ee50221
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pykern/pkunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,14 @@ def _check_port(port):
s.bind((LOCALHOST_IP, int(port)))
return port

for p in random.sample(range(start, stop), 10):
for p in random.sample(range(start, stop), 100):
try:
return _check_port(p)
except Exception:
pass
raise ValueError(f"unable find port in range={start}-{stop} ip={LOCALHOST_IP}")
raise ValueError(
f"unable find port random sample range={start}-{stop} tries=100 ip={LOCALHOST_IP}"
)


def is_test_run():
Expand Down

0 comments on commit ee50221

Please sign in to comment.