Mercurial > hg
comparison tests/run-tests.py @ 47233:bcafcd779d2e
branching: merge stable into default
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Mon, 17 May 2021 15:05:24 +0200 |
parents | 6f976d54946c dff19fe2973c |
children | bb4606f35d37 |
comparison
equal
deleted
inserted
replaced
47232:33096e77598c | 47233:bcafcd779d2e |
---|---|
260 s.bind(('localhost', port)) | 260 s.bind(('localhost', port)) |
261 return True | 261 return True |
262 except socket.error as exc: | 262 except socket.error as exc: |
263 if os.name == 'nt' and exc.errno == errno.WSAEACCES: | 263 if os.name == 'nt' and exc.errno == errno.WSAEACCES: |
264 return False | 264 return False |
265 elif exc.errno not in ( | 265 elif PYTHON3: |
266 # TODO: make a proper exception handler after dropping py2. This | |
267 # works because socket.error is an alias for OSError on py3, | |
268 # which is also the baseclass of PermissionError. | |
269 if isinstance(exc, PermissionError): | |
270 return False | |
271 if exc.errno not in ( | |
266 errno.EADDRINUSE, | 272 errno.EADDRINUSE, |
267 errno.EADDRNOTAVAIL, | 273 errno.EADDRNOTAVAIL, |
268 errno.EPROTONOSUPPORT, | 274 errno.EPROTONOSUPPORT, |
269 ): | 275 ): |
270 raise | 276 raise |
353 continue | 359 continue |
354 | 360 |
355 for line in f.readlines(): | 361 for line in f.readlines(): |
356 line = line.split(b'#', 1)[0].strip() | 362 line = line.split(b'#', 1)[0].strip() |
357 if line: | 363 if line: |
358 entries[line] = filename | 364 # Ensure path entries are compatible with os.path.relpath() |
365 entries[os.path.normpath(line)] = filename | |
359 | 366 |
360 f.close() | 367 f.close() |
361 return entries | 368 return entries |
362 | 369 |
363 | 370 |