##// END OF EJS Templates
run-tests: drop a workaround for python2...
Matt Harbison -
r50771:a77c1375 default
parent child Browse files
Show More
@@ -272,14 +272,11 b' def checkportisavailable(port):'
272 with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s:
272 with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s:
273 s.bind(('localhost', port))
273 s.bind(('localhost', port))
274 return True
274 return True
275 except PermissionError:
276 return False
275 except socket.error as exc:
277 except socket.error as exc:
276 if WINDOWS and exc.errno == errno.WSAEACCES:
278 if WINDOWS and exc.errno == errno.WSAEACCES:
277 return False
279 return False
278 # TODO: make a proper exception handler after dropping py2. This
279 # works because socket.error is an alias for OSError on py3,
280 # which is also the baseclass of PermissionError.
281 elif isinstance(exc, PermissionError):
282 return False
283 if exc.errno not in (
280 if exc.errno not in (
284 errno.EADDRINUSE,
281 errno.EADDRINUSE,
285 errno.EADDRNOTAVAIL,
282 errno.EADDRNOTAVAIL,
General Comments 0
You need to be logged in to leave comments. Login now