diff options
author | Facundo Batista <facundobatista@gmail.com> | 2008-05-29 16:39:26 (GMT) |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2008-05-29 16:39:26 (GMT) |
commit | 4f1b1ed975fe25170d00559e63f992c9bf8e9b8a (patch) | |
tree | 0f2a0434dc9ad0181633f649611e417aa4a6ea61 /Lib/test/test_urllib2.py | |
parent | f18a70720542268586e271bbadab3fb0332b8a39 (diff) | |
download | cpython-4f1b1ed975fe25170d00559e63f992c9bf8e9b8a.zip cpython-4f1b1ed975fe25170d00559e63f992c9bf8e9b8a.tar.gz cpython-4f1b1ed975fe25170d00559e63f992c9bf8e9b8a.tar.bz2 |
Fixed the semantic of timeout for socket.create_connection and
all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r-- | Lib/test/test_urllib2.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 8d17e05..1e93fdb 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -2,6 +2,7 @@ import unittest from test import test_support import os +import socket import StringIO import urllib2 @@ -551,14 +552,15 @@ class HandlerTests(unittest.TestCase): class NullFTPHandler(urllib2.FTPHandler): def __init__(self, data): self.data = data - def connect_ftp(self, user, passwd, host, port, dirs, timeout=None): + def connect_ftp(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.user, self.passwd = user, passwd self.host, self.port = host, port self.dirs = dirs self.ftpwrapper = MockFTPWrapper(self.data) return self.ftpwrapper - import ftplib, socket + import ftplib data = "rheum rhaponicum" h = NullFTPHandler(data) o = h.parent = MockOpener() @@ -691,7 +693,7 @@ class HandlerTests(unittest.TestCase): self.req_headers = [] self.data = None self.raise_on_endheaders = False - def __call__(self, host, timeout=None): + def __call__(self, host, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.host = host self.timeout = timeout return self |