Mercurial > hg
comparison tests/run-tests.py @ 48858:9d01ab54df3f
tests: collapse elif PYTHON3 block
PYTHON3 is always True now so this logic should be identical as to before.
Differential Revision: https://phab.mercurial-scm.org/D12236
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 20 Feb 2022 13:19:21 -0700 |
parents | 41c552a20716 |
children | f928dec9add7 |
comparison
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 ): |