Merged revisions 85492 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85492 | antoine.pitrou | 2010-10-14 22:35:26 +0200 (jeu., 14 oct. 2010) | 3 lines

  Increase timeouts in test_ftplib (for very slow buildbots)
........
This commit is contained in:
Antoine Pitrou 2010-10-14 20:46:25 +00:00
parent d989f820c8
commit 8299393122
1 changed files with 9 additions and 9 deletions

View File

@ -99,7 +99,7 @@ class DummyFTPHandler(asynchat.async_chat):
addr = map(int, arg.split(',')) addr = map(int, arg.split(','))
ip = '%d.%d.%d.%d' %tuple(addr[:4]) ip = '%d.%d.%d.%d' %tuple(addr[:4])
port = (addr[4] * 256) + addr[5] port = (addr[4] * 256) + addr[5]
s = socket.create_connection((ip, port), timeout=2) s = socket.create_connection((ip, port), timeout=10)
self.dtp = self.dtp_handler(s, baseclass=self) self.dtp = self.dtp_handler(s, baseclass=self)
self.push('200 active data connection established') self.push('200 active data connection established')
@ -107,7 +107,7 @@ class DummyFTPHandler(asynchat.async_chat):
sock = socket.socket() sock = socket.socket()
sock.bind((self.socket.getsockname()[0], 0)) sock.bind((self.socket.getsockname()[0], 0))
sock.listen(5) sock.listen(5)
sock.settimeout(2) sock.settimeout(10)
ip, port = sock.getsockname()[:2] ip, port = sock.getsockname()[:2]
ip = ip.replace('.', ',') ip = ip.replace('.', ',')
p1, p2 = divmod(port, 256) p1, p2 = divmod(port, 256)
@ -118,7 +118,7 @@ class DummyFTPHandler(asynchat.async_chat):
def cmd_eprt(self, arg): def cmd_eprt(self, arg):
af, ip, port = arg.split(arg[0])[1:-1] af, ip, port = arg.split(arg[0])[1:-1]
port = int(port) port = int(port)
s = socket.create_connection((ip, port), timeout=2) s = socket.create_connection((ip, port), timeout=10)
self.dtp = self.dtp_handler(s, baseclass=self) self.dtp = self.dtp_handler(s, baseclass=self)
self.push('200 active data connection established') self.push('200 active data connection established')
@ -126,7 +126,7 @@ class DummyFTPHandler(asynchat.async_chat):
sock = socket.socket(socket.AF_INET6) sock = socket.socket(socket.AF_INET6)
sock.bind((self.socket.getsockname()[0], 0)) sock.bind((self.socket.getsockname()[0], 0))
sock.listen(5) sock.listen(5)
sock.settimeout(2) sock.settimeout(10)
port = sock.getsockname()[1] port = sock.getsockname()[1]
self.push('229 entering extended passive mode (|||%d|)' %port) self.push('229 entering extended passive mode (|||%d|)' %port)
conn, addr = sock.accept() conn, addr = sock.accept()
@ -403,7 +403,7 @@ class TestFTPClass(TestCase):
def setUp(self): def setUp(self):
self.server = DummyFTPServer((HOST, 0)) self.server = DummyFTPServer((HOST, 0))
self.server.start() self.server.start()
self.client = ftplib.FTP(timeout=2) self.client = ftplib.FTP(timeout=10)
self.client.connect(self.server.host, self.server.port) self.client.connect(self.server.host, self.server.port)
def tearDown(self): def tearDown(self):
@ -545,7 +545,7 @@ class TestFTPClass(TestCase):
def test_makepasv(self): def test_makepasv(self):
host, port = self.client.makepasv() host, port = self.client.makepasv()
conn = socket.create_connection((host, port), 2) conn = socket.create_connection((host, port), 10)
conn.close() conn.close()
# IPv4 is in use, just make sure send_epsv has not been used # IPv4 is in use, just make sure send_epsv has not been used
self.assertEqual(self.server.handler.last_received_cmd, 'pasv') self.assertEqual(self.server.handler.last_received_cmd, 'pasv')
@ -572,7 +572,7 @@ class TestIPv6Environment(TestCase):
def test_makepasv(self): def test_makepasv(self):
host, port = self.client.makepasv() host, port = self.client.makepasv()
conn = socket.create_connection((host, port), 2) conn = socket.create_connection((host, port), 10)
conn.close() conn.close()
self.assertEqual(self.server.handler.last_received_cmd, 'epsv') self.assertEqual(self.server.handler.last_received_cmd, 'epsv')
@ -595,7 +595,7 @@ class TestTLS_FTPClassMixin(TestFTPClass):
def setUp(self): def setUp(self):
self.server = DummyTLS_FTPServer((HOST, 0)) self.server = DummyTLS_FTPServer((HOST, 0))
self.server.start() self.server.start()
self.client = ftplib.FTP_TLS(timeout=2) self.client = ftplib.FTP_TLS(timeout=10)
self.client.connect(self.server.host, self.server.port) self.client.connect(self.server.host, self.server.port)
# enable TLS # enable TLS
self.client.auth() self.client.auth()
@ -608,7 +608,7 @@ class TestTLS_FTPClass(TestCase):
def setUp(self): def setUp(self):
self.server = DummyTLS_FTPServer((HOST, 0)) self.server = DummyTLS_FTPServer((HOST, 0))
self.server.start() self.server.start()
self.client = ftplib.FTP_TLS(timeout=2) self.client = ftplib.FTP_TLS(timeout=10)
self.client.connect(self.server.host, self.server.port) self.client.connect(self.server.host, self.server.port)
def tearDown(self): def tearDown(self):