mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #12804: Fix test failures on systems without internet access.
This commit is contained in:
parent
a58c01ba48
commit
61baebd0e1
3 changed files with 16 additions and 6 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue