diff tests/run-tests.py @ 47233:bcafcd779d2e

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 17 May 2021 15:05:24 +0200
parents 6f976d54946c dff19fe2973c
children bb4606f35d37
line wrap: on
line diff
--- a/tests/run-tests.py	Mon May 03 12:34:01 2021 +0200
+++ b/tests/run-tests.py	Mon May 17 15:05:24 2021 +0200
@@ -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,
@@ -355,7 +361,8 @@
         for line in f.readlines():
             line = line.split(b'#', 1)[0].strip()
             if line:
-                entries[line] = filename
+                # Ensure path entries are compatible with os.path.relpath()
+                entries[os.path.normpath(line)] = filename
 
         f.close()
     return entries