mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Get this test to pass
This commit is contained in:
parent
e3777b4e92
commit
2f14258196
1 changed files with 4 additions and 3 deletions
|
@ -17,7 +17,8 @@ def _urlopen_with_retry(host, *args, **kwargs):
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
try:
|
try:
|
||||||
return urllib2.urlopen(host, *args, **kwargs)
|
return urllib2.urlopen(host, *args, **kwargs)
|
||||||
except urllib2.URLError as last_exc:
|
except urllib2.URLError as e:
|
||||||
|
last_exc = e
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
@ -310,13 +311,13 @@ class TimeoutTest(unittest.TestCase):
|
||||||
socket.setdefaulttimeout(60)
|
socket.setdefaulttimeout(60)
|
||||||
try:
|
try:
|
||||||
u = _urlopen_with_retry(self.FTP_HOST, timeout=None)
|
u = _urlopen_with_retry(self.FTP_HOST, timeout=None)
|
||||||
self.assertEqual(u.fp.fp._sock.gettimeout(), 60)
|
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
|
||||||
finally:
|
finally:
|
||||||
socket.setdefaulttimeout(prev)
|
socket.setdefaulttimeout(prev)
|
||||||
|
|
||||||
def test_ftp_NoneNodefault(self):
|
def test_ftp_NoneNodefault(self):
|
||||||
u = _urlopen_with_retry(self.FTP_HOST, timeout=None)
|
u = _urlopen_with_retry(self.FTP_HOST, timeout=None)
|
||||||
self.assertTrue(u.fp.fp._sock.gettimeout() is None)
|
self.assertTrue(u.fp.fp.raw._sock.gettimeout() is None)
|
||||||
|
|
||||||
def test_ftp_Value(self):
|
def test_ftp_Value(self):
|
||||||
u = _urlopen_with_retry(self.FTP_HOST, timeout=60)
|
u = _urlopen_with_retry(self.FTP_HOST, timeout=60)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue