Mercurial > hg
changeset 49875:a77c1375c316
run-tests: drop a workaround for python2
The problem is only on python3, but the awkward handling was because python2
didn't have this exception type. I've sporadically seen it running in WSL, but
no clue what it means.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 19 Jul 2022 16:46:37 -0400 |
parents | cd3b8fd1d3eb |
children | 950c39918bd2 |
files | tests/run-tests.py |
diffstat | 1 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Tue Jan 03 23:53:44 2023 -0500 +++ b/tests/run-tests.py Tue Jul 19 16:46:37 2022 -0400 @@ -272,14 +272,11 @@ with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s: s.bind(('localhost', port)) return True + except PermissionError: + return False except socket.error as exc: if WINDOWS and exc.errno == errno.WSAEACCES: return False - # TODO: make a proper exception handler after dropping py2. This - # works because socket.error is an alias for OSError on py3, - # which is also the baseclass of PermissionError. - elif isinstance(exc, PermissionError): - return False if exc.errno not in ( errno.EADDRINUSE, errno.EADDRNOTAVAIL,