summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2net.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-01-25 06:02:05 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-01-25 06:02:05 (GMT)
commit61baebd0e125ba281c2b1f40c210ce286e2e4f0d (patch)
tree6a153638ef9e6f4377fd892a02c2b8e46fbc08a3 /Lib/test/test_urllib2net.py
parenta58c01ba48a4426db45dff71324be6c617efa724 (diff)
downloadcpython-61baebd0e125ba281c2b1f40c210ce286e2e4f0d.zip
cpython-61baebd0e125ba281c2b1f40c210ce286e2e4f0d.tar.gz
cpython-61baebd0e125ba281c2b1f40c210ce286e2e4f0d.tar.bz2
Issue #12804: Fix test failures on systems without internet access.
Diffstat (limited to 'Lib/test/test_urllib2net.py')
-rw-r--r--Lib/test/test_urllib2net.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index 5fcb4cb..fc5527e 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):