Issue #11748: try to fix sporadic failures in test_ftplib
This commit is contained in:
parent
a7caec74aa
commit
6dca52772b
|
@ -611,16 +611,26 @@ class TestFTPClass(TestCase):
|
|||
def test_source_address(self):
|
||||
self.client.quit()
|
||||
port = support.find_unused_port()
|
||||
self.client.connect(self.server.host, self.server.port,
|
||||
source_address=(HOST, port))
|
||||
self.assertEqual(self.client.sock.getsockname()[1], port)
|
||||
self.client.quit()
|
||||
try:
|
||||
self.client.connect(self.server.host, self.server.port,
|
||||
source_address=(HOST, port))
|
||||
self.assertEqual(self.client.sock.getsockname()[1], port)
|
||||
self.client.quit()
|
||||
except IOError as e:
|
||||
if e.errno == errno.EADDRINUSE:
|
||||
self.skipTest("couldn't bind to port %d" % port)
|
||||
raise
|
||||
|
||||
def test_source_address_passive_connection(self):
|
||||
port = support.find_unused_port()
|
||||
self.client.source_address = (HOST, port)
|
||||
with self.client.transfercmd('list') as sock:
|
||||
self.assertEqual(sock.getsockname()[1], port)
|
||||
try:
|
||||
with self.client.transfercmd('list') as sock:
|
||||
self.assertEqual(sock.getsockname()[1], port)
|
||||
except IOError as e:
|
||||
if e.errno == errno.EADDRINUSE:
|
||||
self.skipTest("couldn't bind to port %d" % port)
|
||||
raise
|
||||
|
||||
def test_parse257(self):
|
||||
self.assertEqual(ftplib.parse257('257 "/foo/bar"'), '/foo/bar')
|
||||
|
|
Loading…
Reference in New Issue