tests/run-tests.py
changeset 49876 a77c1375c316
parent 49833 a2356e15200a
child 49977 afa9d73780e1
--- 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,