mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +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
|
|
@ -5,9 +5,10 @@ import threading
|
|||
import contextlib
|
||||
|
||||
from test import support
|
||||
from test.support import socket_helper
|
||||
import unittest
|
||||
|
||||
HOST = support.HOST
|
||||
HOST = socket_helper.HOST
|
||||
|
||||
def server(evt, serv):
|
||||
serv.listen()
|
||||
|
|
@ -26,7 +27,7 @@ class GeneralTests(unittest.TestCase):
|
|||
self.evt = threading.Event()
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.settimeout(60) # Safety net. Look issue 11812
|
||||
self.port = support.bind_port(self.sock)
|
||||
self.port = socket_helper.bind_port(self.sock)
|
||||
self.thread = threading.Thread(target=server, args=(self.evt,self.sock))
|
||||
self.thread.setDaemon(True)
|
||||
self.thread.start()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue