# HG changeset patch # User Matt Harbison # Date 1610950510 18000 # Node ID 85c0c7145f8ef86272c679ccda7339d72798a3e3 # Parent 3e23794b9e1c94a4b4eea6f79e1f056608de1f43 run-tests: catch a Windows specific error when testing for a free socket I'm not sure why this only happens with py3, but this error code doesn't map to any of the 3 currently being handled, and kills `run-tests.py` before it can run any tests when it happens: OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions The documentation[1] says this can happen if another process is bound to the address with exclusive access. This seems to keep it happy. [1] https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 Differential Revision: https://phab.mercurial-scm.org/D9816 diff -r 3e23794b9e1c -r 85c0c7145f8e tests/run-tests.py --- a/tests/run-tests.py Mon Jan 18 00:50:01 2021 -0500 +++ b/tests/run-tests.py Mon Jan 18 01:15:10 2021 -0500 @@ -260,7 +260,9 @@ s.bind(('localhost', port)) return True except socket.error as exc: - if exc.errno not in ( + if os.name == 'nt' and exc.errno == errno.WSAEACCES: + return False + elif exc.errno not in ( errno.EADDRINUSE, errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT,