[Python-checkins] cpython: test_ftplib.py: change client default timeout from 10 to 2. Hanging for 10

giampaolo.rodola python-checkins at python.org
Sat May 7 17:08:43 CEST 2011


http://hg.python.org/cpython/rev/9688977ef567
changeset: 69908:9688977ef567
user: Giampaolo Rodola' <g.rodola at gmail.com>
date: Sat May 07 17:08:34 2011 +0200
summary:
 test_ftplib.py: change client default timeout from 10 to 2. Hanging for 10 seconds is way too much when we expect a server response which never comes in.
files:
 Lib/test/test_ftplib.py | 18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -123,7 +123,7 @@
 addr = list(map(int, arg.split(',')))
 ip = '%d.%d.%d.%d' %tuple(addr[:4])
 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.push('200 active data connection established')
 
@@ -141,7 +141,7 @@
 def cmd_eprt(self, arg):
 af, ip, port = arg.split(arg[0])[1:-1]
 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.push('200 active data connection established')
 
@@ -440,7 +440,7 @@
 def setUp(self):
 self.server = DummyFTPServer((HOST, 0))
 self.server.start()
- self.client = ftplib.FTP(timeout=2)
+ self.client = ftplib.FTP(timeout=10)
 self.client.connect(self.server.host, self.server.port)
 
 def tearDown(self):
@@ -663,7 +663,7 @@
 return True
 
 # base test
- with ftplib.FTP(timeout=2) as self.client:
+ with ftplib.FTP(timeout=10) as self.client:
 self.client.connect(self.server.host, self.server.port)
 self.client.sendcmd('noop')
 self.assertTrue(is_client_connected())
@@ -671,7 +671,7 @@
 self.assertFalse(is_client_connected())
 
 # QUIT sent inside the with block
- with ftplib.FTP(timeout=2) as self.client:
+ with ftplib.FTP(timeout=10) as self.client:
 self.client.connect(self.server.host, self.server.port)
 self.client.sendcmd('noop')
 self.client.quit()
@@ -681,7 +681,7 @@
 # force a wrong response code to be sent on QUIT: error_perm
 # is expected and the connection is supposed to be closed
 try:
- with ftplib.FTP(timeout=2) as self.client:
+ with ftplib.FTP(timeout=10) as self.client:
 self.client.connect(self.server.host, self.server.port)
 self.client.sendcmd('noop')
 self.server.handler_instance.next_response = '550 error on quit'
@@ -779,7 +779,7 @@
 def setUp(self):
 self.server = DummyTLS_FTPServer((HOST, 0))
 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)
 # enable TLS
 self.client.auth()
@@ -792,7 +792,7 @@
 def setUp(self):
 self.server = DummyTLS_FTPServer((HOST, 0))
 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)
 
 def tearDown(self):
@@ -852,7 +852,7 @@
 self.assertRaises(ValueError, ftplib.FTP_TLS, certfile=CERTFILE,
 keyfile=CERTFILE, context=ctx)
 
- self.client = ftplib.FTP_TLS(context=ctx, timeout=2)
+ self.client = ftplib.FTP_TLS(context=ctx, timeout=10)
 self.client.connect(self.server.host, self.server.port)
 self.assertNotIsInstance(self.client.sock, ssl.SSLSocket)
 self.client.auth()
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /