r69209 caused the fp of HTTPResponse objects to be a io.BufferedReader instead of a socket.SocketIO. This moves the underlying socket.socket object from r.fp._sock to r.fp.raw._sock. Since _sock is an internal object, this should be ok. The change is for the testsuite only, to assert socket state.
This commit is contained in:
parent
0e974b895f
commit
3bbfba841a
|
@ -195,7 +195,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
def test_http_basic(self):
|
def test_http_basic(self):
|
||||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||||
u = _urlopen_with_retry("http://www.python.org")
|
u = _urlopen_with_retry("http://www.python.org")
|
||||||
self.assertTrue(u.fp._sock.gettimeout() is None)
|
self.assertTrue(u.fp.raw._sock.gettimeout() is None)
|
||||||
|
|
||||||
def test_http_default_timeout(self):
|
def test_http_default_timeout(self):
|
||||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||||
|
@ -204,7 +204,7 @@ class TimeoutTest(unittest.TestCase):
|
||||||
u = _urlopen_with_retry("http://www.python.org")
|
u = _urlopen_with_retry("http://www.python.org")
|
||||||
finally:
|
finally:
|
||||||
socket.setdefaulttimeout(None)
|
socket.setdefaulttimeout(None)
|
||||||
self.assertEqual(u.fp._sock.gettimeout(), 60)
|
self.assertEqual(u.fp.raw._sock.gettimeout(), 60)
|
||||||
|
|
||||||
def test_http_no_timeout(self):
|
def test_http_no_timeout(self):
|
||||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||||
|
@ -213,11 +213,11 @@ class TimeoutTest(unittest.TestCase):
|
||||||
u = _urlopen_with_retry("http://www.python.org", timeout=None)
|
u = _urlopen_with_retry("http://www.python.org", timeout=None)
|
||||||
finally:
|
finally:
|
||||||
socket.setdefaulttimeout(None)
|
socket.setdefaulttimeout(None)
|
||||||
self.assertTrue(u.fp._sock.gettimeout() is None)
|
self.assertTrue(u.fp.raw._sock.gettimeout() is None)
|
||||||
|
|
||||||
def test_http_timeout(self):
|
def test_http_timeout(self):
|
||||||
u = _urlopen_with_retry("http://www.python.org", timeout=120)
|
u = _urlopen_with_retry("http://www.python.org", timeout=120)
|
||||||
self.assertEqual(u.fp._sock.gettimeout(), 120)
|
self.assertEqual(u.fp.raw._sock.gettimeout(), 120)
|
||||||
|
|
||||||
FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/"
|
FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue