diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-04-25 07:06:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 07:06:29 (GMT) |
commit | 16994912c93e8e5db7365d48b75d67d3f70dd7b2 (patch) | |
tree | 248f177a93676406af6d6ae977bed868aa2d1a34 /Lib/test/test_imaplib.py | |
parent | 3c8a5b459d68b4337776ada1e04f5b33f90a2275 (diff) | |
download | cpython-16994912c93e8e5db7365d48b75d67d3f70dd7b2.zip cpython-16994912c93e8e5db7365d48b75d67d3f70dd7b2.tar.gz cpython-16994912c93e8e5db7365d48b75d67d3f70dd7b2.tar.bz2 |
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_imaplib.py')
-rw-r--r-- | Lib/test/test_imaplib.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 91aa771..7645666 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -1,4 +1,5 @@ from test import support +from test.support import socket_helper from contextlib import contextmanager import imaplib @@ -82,7 +83,7 @@ class TestImaplib(unittest.TestCase): pass # This is the exception that should be raised. - expected_errnos = support.get_socket_conn_refused_errs() + expected_errnos = socket_helper.get_socket_conn_refused_errs() with self.assertRaises(OSError) as cm: imaplib.IMAP4() self.assertIn(cm.exception.errno, expected_errnos) @@ -210,7 +211,7 @@ class NewIMAPTestsMixin(): raise self.addCleanup(self._cleanup) - self.server = self.server_class((support.HOST, 0), imap_handler) + self.server = self.server_class((socket_helper.HOST, 0), imap_handler) self.thread = threading.Thread( name=self._testMethodName+'-server', target=self.server.serve_forever, @@ -600,7 +601,7 @@ class ThreadedNetworkedTests(unittest.TestCase): @contextmanager def reaped_server(self, hdlr): - server, thread = self.make_server((support.HOST, 0), hdlr) + server, thread = self.make_server((socket_helper.HOST, 0), hdlr) try: yield server finally: |