mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
3c8a5b459d
commit
16994912c9
37 changed files with 472 additions and 429 deletions
|
@ -26,6 +26,7 @@ import warnings
|
|||
import test.support
|
||||
import test.support.script_helper
|
||||
from test import support
|
||||
from test.support import socket_helper
|
||||
|
||||
|
||||
# Skip tests if _multiprocessing wasn't built.
|
||||
|
@ -2928,7 +2929,7 @@ class _TestRemoteManager(BaseTestCase):
|
|||
authkey = os.urandom(32)
|
||||
|
||||
manager = QueueManager(
|
||||
address=(test.support.HOST, 0), authkey=authkey, serializer=SERIALIZER
|
||||
address=(socket_helper.HOST, 0), authkey=authkey, serializer=SERIALIZER
|
||||
)
|
||||
manager.start()
|
||||
self.addCleanup(manager.shutdown)
|
||||
|
@ -2965,7 +2966,7 @@ class _TestManagerRestart(BaseTestCase):
|
|||
def test_rapid_restart(self):
|
||||
authkey = os.urandom(32)
|
||||
manager = QueueManager(
|
||||
address=(test.support.HOST, 0), authkey=authkey, serializer=SERIALIZER)
|
||||
address=(socket_helper.HOST, 0), authkey=authkey, serializer=SERIALIZER)
|
||||
try:
|
||||
srvr = manager.get_server()
|
||||
addr = srvr.address
|
||||
|
@ -3455,7 +3456,7 @@ class _TestPicklingConnections(BaseTestCase):
|
|||
new_conn.close()
|
||||
l.close()
|
||||
|
||||
l = socket.create_server((test.support.HOST, 0))
|
||||
l = socket.create_server((socket_helper.HOST, 0))
|
||||
conn.send(l.getsockname())
|
||||
new_conn, addr = l.accept()
|
||||
conn.send(new_conn)
|
||||
|
@ -4593,7 +4594,7 @@ class TestWait(unittest.TestCase):
|
|||
|
||||
def test_wait_socket(self, slow=False):
|
||||
from multiprocessing.connection import wait
|
||||
l = socket.create_server((test.support.HOST, 0))
|
||||
l = socket.create_server((socket_helper.HOST, 0))
|
||||
addr = l.getsockname()
|
||||
readers = []
|
||||
procs = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue