summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllibnet.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-04-29 07:36:20 (GMT)
committerGitHub <noreply@github.com>2020-04-29 07:36:20 (GMT)
commitbfb1cf44658934cbcd9707fb717d6770c78fbeb3 (patch)
treea9dcce79d42f76509491b3d8b165f6737143cbc5 /Lib/test/test_urllibnet.py
parentbb4a585d903e7fe0a46ded8c2ee3f47435ad6a66 (diff)
downloadcpython-bfb1cf44658934cbcd9707fb717d6770c78fbeb3.zip
cpython-bfb1cf44658934cbcd9707fb717d6770c78fbeb3.tar.gz
cpython-bfb1cf44658934cbcd9707fb717d6770c78fbeb3.tar.bz2
bpo-40275: Move transient_internet from test.support to socket_helper (GH-19711)
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