comparison tests/run-tests.py @ 48956:c194e93d1ebc

tests: support another error case when detecting ipv4/ipv6 support I encountered this on Linux in a VM environment with a rather strange networking setup (both on the host and in the VM). Differential Revision: https://phab.mercurial-scm.org/D12371
author Kyle Lippincott <spectral@google.com>
date Wed, 09 Mar 2022 21:26:58 -0800
parents 642e31cb55f0
children 7e18fc0bc46c
comparison
equal deleted inserted replaced
48955:db960032d522 48956: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