Commit 4a3ffb9e authored by Tres Seaver's avatar Tres Seaver

Suppress Py3k resource warnings for sockets.

parent aec09788
......@@ -284,6 +284,7 @@ def get_port2(test):
except socket.error as e:
if e.args[0] != errno.EADDRINUSE:
raise
s.close()
continue
if not (can_connect(port) or can_connect(port+1)):
......@@ -296,13 +297,15 @@ def get_port2(test):
def can_connect(port):
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
try:
c.connect(('localhost', port))
except socket.error:
return False # Perhaps we should check value of error too.
else:
c.close()
return True
finally:
c.close()
def setUp(test):
ZODB.tests.util.setUp(test)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment