mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01: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
|
|
@ -1,6 +1,7 @@
|
|||
# test asynchat
|
||||
|
||||
from test import support
|
||||
from test.support import socket_helper
|
||||
|
||||
import asynchat
|
||||
import asyncore
|
||||
|
|
@ -12,7 +13,7 @@ import time
|
|||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
HOST = support.HOST
|
||||
HOST = socket_helper.HOST
|
||||
SERVER_QUIT = b'QUIT\n'
|
||||
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ class echo_server(threading.Thread):
|
|||
threading.Thread.__init__(self)
|
||||
self.event = event
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.port = support.bind_port(self.sock)
|
||||
self.port = socket_helper.bind_port(self.sock)
|
||||
# This will be set if the client wants us to wait before echoing
|
||||
# data back.
|
||||
self.start_resend_event = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue