diff options
author | Stéphane Wirtel <stephane@wirtel.be> | 2019-03-05 14:18:58 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-03-05 14:18:58 (GMT) |
commit | 84772e0ab49ee09acb44e30551aa5cfc1eafe5dc (patch) | |
tree | 7f060c2d7e87d0cc2ec4048375f3f746d8102177 /Lib/test/test_urllib2net.py | |
parent | d9bf7f4198871132714cfe7d702baaa02206e9f1 (diff) | |
download | cpython-84772e0ab49ee09acb44e30551aa5cfc1eafe5dc.zip cpython-84772e0ab49ee09acb44e30551aa5cfc1eafe5dc.tar.gz cpython-84772e0ab49ee09acb44e30551aa5cfc1eafe5dc.tar.bz2 |
[2.7] bpo-36019: Use pythontest.net in urllib network tests (GH-11941) (GH-12177)
Use test_support.TEST_HTTP_URL (pythontest.net) instead of http://www.example.com/.
Diffstat (limited to 'Lib/test/test_urllib2net.py')
-rw-r--r-- | Lib/test/test_urllib2net.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index ee0b7fe..1cd80f2 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -85,7 +85,7 @@ class CloseSocketTest(unittest.TestCase): # underlying socket # delve deep into response to fetch socket._socketobject - response = _urlopen_with_retry("http://www.example.com/") + response = _urlopen_with_retry(test_support.TEST_HTTP_URL) abused_fileobject = response.fp self.assertIs(abused_fileobject.__class__, socket._fileobject) httpresponse = abused_fileobject._sock @@ -169,7 +169,7 @@ class OtherNetworkTests(unittest.TestCase): "http://www.pythontest.net/index.html#frag") def test_fileno(self): - req = urllib2.Request("http://www.example.com") + req = urllib2.Request(test_support.TEST_HTTP_URL) opener = urllib2.build_opener() res = opener.open(req) try: @@ -180,7 +180,7 @@ class OtherNetworkTests(unittest.TestCase): res.close() def test_custom_headers(self): - url = "http://www.example.com" + url = test_support.TEST_HTTP_URL with test_support.transient_internet(url): opener = urllib2.build_opener() request = urllib2.Request(url) @@ -258,14 +258,14 @@ class OtherNetworkTests(unittest.TestCase): class TimeoutTest(unittest.TestCase): def test_http_basic(self): self.assertIsNone(socket.getdefaulttimeout()) - url = "http://www.example.com" + url = test_support.TEST_HTTP_URL with test_support.transient_internet(url, timeout=None): u = _urlopen_with_retry(url) self.assertIsNone(u.fp._sock.fp._sock.gettimeout()) def test_http_default_timeout(self): self.assertIsNone(socket.getdefaulttimeout()) - url = "http://www.example.com" + url = test_support.TEST_HTTP_URL with test_support.transient_internet(url): socket.setdefaulttimeout(60) try: @@ -276,7 +276,7 @@ class TimeoutTest(unittest.TestCase): def test_http_no_timeout(self): self.assertIsNone(socket.getdefaulttimeout()) - url = "http://www.example.com" + url = test_support.TEST_HTTP_URL with test_support.transient_internet(url): socket.setdefaulttimeout(60) try: @@ -286,7 +286,7 @@ class TimeoutTest(unittest.TestCase): self.assertIsNone(u.fp._sock.fp._sock.gettimeout()) def test_http_timeout(self): - url = "http://www.example.com" + url = test_support.TEST_HTTP_URL with test_support.transient_internet(url): u = _urlopen_with_retry(url, timeout=120) self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) |