tests/run-tests.py
changeset 49047 c194e93d1ebc
parent 49037 642e31cb55f0
child 49053 7e18fc0bc46c
equal deleted inserted replaced
49046:db960032d522 49047:c194e93d1ebc
   236     try:
   236     try:
   237         s = socket.socket(family, socket.SOCK_STREAM)
   237         s = socket.socket(family, socket.SOCK_STREAM)
   238         s.bind(('localhost', port))
   238         s.bind(('localhost', port))
   239         s.close()
   239         s.close()
   240         return True
   240         return True
   241     except socket.error as exc:
   241     except (socket.error, OSError) as exc:
   242         if exc.errno == errno.EADDRINUSE:
   242         if exc.errno == errno.EADDRINUSE:
   243             return True
   243             return True
   244         elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT):
   244         elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT,
       
   245                            errno.EAFNOSUPPORT):
   245             return False
   246             return False
   246         else:
   247         else:
   247             raise
   248             raise
   248     else:
   249     else:
   249         return False
   250         return False