mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20939: Use www.example.com instead of www.python.org to avoid test
failures when ssl is not present.
This commit is contained in:
parent
fd9262cf2a
commit
e558181660
3 changed files with 25 additions and 18 deletions
10
Lib/test/test_urllib2net.py
Normal file → Executable file
10
Lib/test/test_urllib2net.py
Normal file → Executable file
|
@ -84,7 +84,7 @@ class CloseSocketTest(unittest.TestCase):
|
|||
# calling .close() on urllib2's response objects should close the
|
||||
# underlying socket
|
||||
|
||||
response = _urlopen_with_retry("http://www.python.org/")
|
||||
response = _urlopen_with_retry("http://www.example.com/")
|
||||
sock = response.fp
|
||||
self.assertTrue(not sock.closed)
|
||||
response.close()
|
||||
|
@ -254,7 +254,7 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
class TimeoutTest(unittest.TestCase):
|
||||
def test_http_basic(self):
|
||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||
url = "http://www.python.org"
|
||||
url = "http://www.example.com"
|
||||
with support.transient_internet(url, timeout=None):
|
||||
u = _urlopen_with_retry(url)
|
||||
self.addCleanup(u.close)
|
||||
|
@ -262,7 +262,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
|
||||
def test_http_default_timeout(self):
|
||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||
url = "http://www.python.org"
|
||||
url = "http://www.example.com"
|
||||
with support.transient_internet(url):
|
||||
socket.setdefaulttimeout(60)
|
||||
try:
|
||||
|
@ -274,7 +274,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
|
||||
def test_http_no_timeout(self):
|
||||
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||
url = "http://www.python.org"
|
||||
url = "http://www.example.com"
|
||||
with support.transient_internet(url):
|
||||
socket.setdefaulttimeout(60)
|
||||
try:
|
||||
|
@ -285,7 +285,7 @@ class TimeoutTest(unittest.TestCase):
|
|||
self.assertTrue(u.fp.raw._sock.gettimeout() is None)
|
||||
|
||||
def test_http_timeout(self):
|
||||
url = "http://www.python.org"
|
||||
url = "http://www.example.com"
|
||||
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