mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Improve failed test diagnostics.
This commit is contained in:
parent
3e29307d65
commit
fb6d35ebea
3 changed files with 6 additions and 5 deletions
|
|
@ -63,11 +63,11 @@ def wait_until_port_is_listening(port, interval=1, max_attempts=1000):
|
|||
try:
|
||||
log.info("Probing localhost:{0} (attempt {1})...", port, i)
|
||||
sock.connect(("localhost", port))
|
||||
except socket.error:
|
||||
except socket.error as exc:
|
||||
# The first attempt will almost always fail, because the port isn't
|
||||
# open yet. But if it keeps failing after that, we want to know why.
|
||||
if i > 1:
|
||||
log.exception()
|
||||
log.warning("Failed to connect to localhost:{0}:\n{1}", port, exc)
|
||||
time.sleep(interval)
|
||||
else:
|
||||
log.info("localhost:{0} is listening - server is up!", port)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue