tests/run-tests.py
changeset 48858 9d01ab54df3f
parent 48857 41c552a20716
child 48859 f928dec9add7
equal deleted inserted replaced
48857:41c552a20716 48858:9d01ab54df3f
   276             s.bind(('localhost', port))
   276             s.bind(('localhost', port))
   277         return True
   277         return True
   278     except socket.error as exc:
   278     except socket.error as exc:
   279         if WINDOWS and exc.errno == errno.WSAEACCES:
   279         if WINDOWS and exc.errno == errno.WSAEACCES:
   280             return False
   280             return False
   281         elif PYTHON3:
   281         # TODO: make a proper exception handler after dropping py2.  This
   282             # TODO: make a proper exception handler after dropping py2.  This
   282         #       works because socket.error is an alias for OSError on py3,
   283             #       works because socket.error is an alias for OSError on py3,
   283         #       which is also the baseclass of PermissionError.
   284             #       which is also the baseclass of PermissionError.
   284         elif isinstance(exc, PermissionError):
   285             if isinstance(exc, PermissionError):
   285             return False
   286                 return False
       
   287         if exc.errno not in (
   286         if exc.errno not in (
   288             errno.EADDRINUSE,
   287             errno.EADDRINUSE,
   289             errno.EADDRNOTAVAIL,
   288             errno.EADDRNOTAVAIL,
   290             errno.EPROTONOSUPPORT,
   289             errno.EPROTONOSUPPORT,
   291         ):
   290         ):