summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllibnet.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_urllibnet.py')
-rw-r--r--Lib/test/test_urllibnet.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 422d529..28680aa 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -1,5 +1,6 @@
import unittest
from test import support
+from test.support import socket_helper
import contextlib
import socket
@@ -27,7 +28,7 @@ class URLTimeoutTest(unittest.TestCase):
self.addCleanup(urllib.request.urlcleanup)
domain = urllib.parse.urlparse(support.TEST_HTTP_URL).netloc
- with support.transient_internet(domain):
+ with socket_helper.transient_internet(domain):
f = urllib.request.urlopen(support.TEST_HTTP_URL)
f.read()
@@ -56,7 +57,7 @@ class urlopenNetworkTests(unittest.TestCase):
@contextlib.contextmanager
def urlopen(self, *args, **kwargs):
resource = args[0]
- with support.transient_internet(resource):
+ with socket_helper.transient_internet(resource):
r = urllib.request.urlopen(*args, **kwargs)
try:
yield r
@@ -98,7 +99,7 @@ class urlopenNetworkTests(unittest.TestCase):
def test_getcode(self):
# test getcode() with the fancy opener to get 404 error codes
URL = self.url + "XXXinvalidXXX"
- with support.transient_internet(URL):
+ with socket_helper.transient_internet(URL):
with self.assertWarns(DeprecationWarning):
open_url = urllib.request.FancyURLopener().open(URL)
try:
@@ -156,7 +157,7 @@ class urlretrieveNetworkTests(unittest.TestCase):
@contextlib.contextmanager
def urlretrieve(self, *args, **kwargs):
resource = args[0]
- with support.transient_internet(resource):
+ with socket_helper.transient_internet(resource):
file_location, info = urllib.request.urlretrieve(*args, **kwargs)
try:
yield file_location, info