diff options
Diffstat (limited to 'Lib/test/test_urllib2net.py')
| -rw-r--r-- | Lib/test/test_urllib2net.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index 5fcb4cb..7f3c93a 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -83,12 +83,13 @@ class CloseSocketTest(unittest.TestCase): def test_close(self): # calling .close() on urllib2's response objects should close the # underlying socket - - response = _urlopen_with_retry("http://www.python.org/") - sock = response.fp - self.assertTrue(not sock.closed) - response.close() - self.assertTrue(sock.closed) + url = "http://www.python.org/" + with support.transient_internet(url): + response = _urlopen_with_retry(url) + sock = response.fp + self.assertTrue(not sock.closed) + response.close() + self.assertTrue(sock.closed) class OtherNetworkTests(unittest.TestCase): def setUp(self): @@ -156,12 +157,12 @@ class OtherNetworkTests(unittest.TestCase): ## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) def test_urlwithfrag(self): - urlwith_frag = "http://docs.python.org/glossary.html#glossary" + urlwith_frag = "http://docs.python.org/2/glossary.html#glossary" with support.transient_internet(urlwith_frag): req = urllib.request.Request(urlwith_frag) res = urllib.request.urlopen(req) self.assertEqual(res.geturl(), - "http://docs.python.org/glossary.html#glossary") + "http://docs.python.org/2/glossary.html#glossary") def test_custom_headers(self): url = "http://www.example.com" |
