mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
This commit is contained in:
parent
3208880f1c
commit
a40681dd5d
6 changed files with 22 additions and 10 deletions
|
@ -84,7 +84,7 @@ class CloseSocketTest(unittest.TestCase):
|
|||
def test_close(self):
|
||||
# calling .close() on urllib2's response objects should close the
|
||||
# underlying socket
|
||||
url = "http://www.example.com/"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url):
|
||||
response = _urlopen_with_retry(url)
|
||||
sock = response.fp
|
||||
|
@ -173,7 +173,7 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
"http://www.pythontest.net/elsewhere/#frag")
|
||||
|
||||
def test_custom_headers(self):
|
||||
url = "http://www.example.com"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url):
|
||||
opener = urllib.request.build_opener()
|
||||
request = urllib.request.Request(url)
|
||||
|
@ -259,7 +259,7 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
class TimeoutTest(unittest.TestCase):
|
||||
def test_http_basic(self):
|
||||
self.assertIsNone(socket.getdefaulttimeout())
|
||||
url = "http://www.example.com"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url, timeout=None):
|
||||
u = _urlopen_with_retry(url)
|
||||
self.addCleanup(u.close)
|
||||
|
@ -267,7 +267,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
|
||||
def test_http_default_timeout(self):
|
||||
self.assertIsNone(socket.getdefaulttimeout())
|
||||
url = "http://www.example.com"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url):
|
||||
socket.setdefaulttimeout(60)
|
||||
try:
|
||||
|
@ -279,7 +279,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
|
||||
def test_http_no_timeout(self):
|
||||
self.assertIsNone(socket.getdefaulttimeout())
|
||||
url = "http://www.example.com"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url):
|
||||
socket.setdefaulttimeout(60)
|
||||
try:
|
||||
|
@ -290,7 +290,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
self.assertIsNone(u.fp.raw._sock.gettimeout())
|
||||
|
||||
def test_http_timeout(self):
|
||||
url = "http://www.example.com"
|
||||
url = support.TEST_HTTP_URL
|
||||
with support.transient_internet(url):
|
||||
u = _urlopen_with_retry(url, timeout=120)
|
||||
self.addCleanup(u.close)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue