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
|
@ -3,6 +3,7 @@ Tests for the threading module.
|
|||
"""
|
||||
|
||||
import test.support
|
||||
from test.support import threading_helper
|
||||
from test.support import verbose, import_module, cpython_only
|
||||
from test.support.script_helper import assert_python_ok, assert_python_failure
|
||||
|
||||
|
@ -75,10 +76,10 @@ class TestThread(threading.Thread):
|
|||
|
||||
class BaseTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._threads = test.support.threading_setup()
|
||||
self._threads = threading_helper.threading_setup()
|
||||
|
||||
def tearDown(self):
|
||||
test.support.threading_cleanup(*self._threads)
|
||||
threading_helper.threading_cleanup(*self._threads)
|
||||
test.support.reap_children()
|
||||
|
||||
|
||||
|
@ -130,7 +131,7 @@ class ThreadTests(BaseTestCase):
|
|||
done.set()
|
||||
done = threading.Event()
|
||||
ident = []
|
||||
with support.wait_threads_exit():
|
||||
with threading_helper.wait_threads_exit():
|
||||
tid = _thread.start_new_thread(f, ())
|
||||
done.wait()
|
||||
self.assertEqual(ident[0], tid)
|
||||
|
@ -171,7 +172,7 @@ class ThreadTests(BaseTestCase):
|
|||
|
||||
mutex = threading.Lock()
|
||||
mutex.acquire()
|
||||
with support.wait_threads_exit():
|
||||
with threading_helper.wait_threads_exit():
|
||||
tid = _thread.start_new_thread(f, (mutex,))
|
||||
# Wait for the thread to finish.
|
||||
mutex.acquire()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue