changeset 47181:6e0af81c43b2 stable

run-tests: ignore PermissionError when checking available ports I'm not sure what this is, but I'm getting it occasionally when running in WSL. When it was raised, none of the tests could run.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 11 Mar 2021 23:20:41 -0500
parents e917fa36fb58
children dff19fe2973c
files tests/run-tests.py tests/test-check-pyflakes.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Apr 12 20:58:19 2021 -0400
+++ b/tests/run-tests.py	Thu Mar 11 23:20:41 2021 -0500
@@ -262,7 +262,13 @@
     except socket.error as exc:
         if os.name == 'nt' and exc.errno == errno.WSAEACCES:
             return False
-        elif exc.errno not in (
+        elif PYTHON3:
+            # 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.
+            if isinstance(exc, PermissionError):
+                return False
+        if exc.errno not in (
             errno.EADDRINUSE,
             errno.EADDRNOTAVAIL,
             errno.EPROTONOSUPPORT,
--- a/tests/test-check-pyflakes.t	Mon Apr 12 20:58:19 2021 -0400
+++ b/tests/test-check-pyflakes.t	Thu Mar 11 23:20:41 2021 -0500
@@ -23,4 +23,5 @@
   mercurial/hgweb/server.py:*:* undefined name 'reload' (glob) (?)
   mercurial/util.py:*:* undefined name 'file' (glob) (?)
   mercurial/encoding.py:*:* undefined name 'localstr' (glob) (?)
+  tests/run-tests.py:*:* undefined name 'PermissionError' (glob) (?)