summaryrefslogtreecommitdiff
path: root/Lib/test/test_ftplib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-04-25 10:06:29 +0300
committerGitHub <noreply@github.com>2020-04-25 10:06:29 +0300
commit16994912c93e8e5db7365d48b75d67d3f70dd7b2 (patch)
tree248f177a93676406af6d6ae977bed868aa2d1a34 /Lib/test/test_ftplib.py
parent3c8a5b459d68b4337776ada1e04f5b33f90a2275 (diff)
downloadcpython-git-16994912c93e8e5db7365d48b75d67d3f70dd7b2.tar.gz
bpo-40275: Avoid importing socket in test.support (GH-19603)
* Move socket related functions from test.support to socket_helper. * Import socket, nntplib and urllib.error lazily in transient_internet(). * Remove importing multiprocess.
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index cf30a3df35..e424076d7d 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -19,7 +19,8 @@ except ImportError:
from unittest import TestCase, skipUnless
from test import support
-from test.support import HOST, HOSTv6
+from test.support import socket_helper
+from test.support.socket_helper import HOST, HOSTv6
TIMEOUT = support.LOOPBACK_TIMEOUT
DEFAULT_ENCODING = 'utf-8'
@@ -751,7 +752,7 @@ class TestFTPClass(TestCase):
def test_source_address(self):
self.client.quit()
- port = support.find_unused_port()
+ port = socket_helper.find_unused_port()
try:
self.client.connect(self.server.host, self.server.port,
source_address=(HOST, port))
@@ -763,7 +764,7 @@ class TestFTPClass(TestCase):
raise
def test_source_address_passive_connection(self):
- port = support.find_unused_port()
+ port = socket_helper.find_unused_port()
self.client.source_address = (HOST, port)
try:
with self.client.transfercmd('list') as sock:
@@ -816,7 +817,7 @@ class TestFTPClass(TestCase):
self.assertEqual(DEFAULT_ENCODING, client.encoding)
-@skipUnless(support.IPV6_ENABLED, "IPv6 not enabled")
+@skipUnless(socket_helper.IPV6_ENABLED, "IPv6 not enabled")
class TestIPv6Environment(TestCase):
def setUp(self):
@@ -1007,7 +1008,7 @@ class TestTimeouts(TestCase):
self.evt = threading.Event()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.settimeout(20)
- self.port = support.bind_port(self.sock)
+ self.port = socket_helper.bind_port(self.sock)
self.server_thread = threading.Thread(target=self.server)
self.server_thread.daemon = True
self.server_thread.start()