mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40275: Adding threading_helper submodule in test.support (GH-20263)
This commit is contained in:
parent
7d80b35af1
commit
e80697d687
46 changed files with 483 additions and 428 deletions
|
@ -30,6 +30,7 @@ from io import BytesIO
|
|||
|
||||
import unittest
|
||||
from test import support
|
||||
from test.support import threading_helper
|
||||
|
||||
|
||||
class NoLogRequestHandler:
|
||||
|
@ -64,7 +65,7 @@ class TestServerThread(threading.Thread):
|
|||
|
||||
class BaseTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._threads = support.threading_setup()
|
||||
self._threads = threading_helper.threading_setup()
|
||||
os.environ = support.EnvironmentVarGuard()
|
||||
self.server_started = threading.Event()
|
||||
self.thread = TestServerThread(self, self.request_handler)
|
||||
|
@ -75,7 +76,7 @@ class BaseTestCase(unittest.TestCase):
|
|||
self.thread.stop()
|
||||
self.thread = None
|
||||
os.environ.__exit__()
|
||||
support.threading_cleanup(*self._threads)
|
||||
threading_helper.threading_cleanup(*self._threads)
|
||||
|
||||
def request(self, uri, method='GET', body=None, headers={}):
|
||||
self.connection = http.client.HTTPConnection(self.HOST, self.PORT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue