##// END OF EJS Templates
run-tests: use a context manager when looking for available ports...
Matt Harbison -
r46569:064449f9 default
parent child Browse files
Show More
@@ -47,6 +47,7 b' from __future__ import absolute_import, '
47 47
48 48 import argparse
49 49 import collections
50 import contextlib
50 51 import difflib
51 52 import distutils.version as version
52 53 import errno
@@ -255,9 +256,8 b' def checkportisavailable(port):'
255 256 else:
256 257 family = socket.AF_INET
257 258 try:
258 s = socket.socket(family, socket.SOCK_STREAM)
259 s.bind(('localhost', port))
260 s.close()
259 with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s:
260 s.bind(('localhost', port))
261 261 return True
262 262 except socket.error as exc:
263 263 if exc.errno not in (
General Comments 0
You need to be logged in to leave comments. Login now