mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +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
|
@ -11,6 +11,7 @@ import unittest
|
|||
import weakref
|
||||
|
||||
from test import support
|
||||
from test.support import threading_helper
|
||||
|
||||
|
||||
requires_fork = unittest.skipUnless(hasattr(os, 'fork'),
|
||||
|
@ -37,7 +38,7 @@ class Bunch(object):
|
|||
self.started = []
|
||||
self.finished = []
|
||||
self._can_exit = not wait_before_exit
|
||||
self.wait_thread = support.wait_threads_exit()
|
||||
self.wait_thread = threading_helper.wait_threads_exit()
|
||||
self.wait_thread.__enter__()
|
||||
|
||||
def task():
|
||||
|
@ -73,10 +74,10 @@ class Bunch(object):
|
|||
|
||||
class BaseTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._threads = support.threading_setup()
|
||||
self._threads = threading_helper.threading_setup()
|
||||
|
||||
def tearDown(self):
|
||||
support.threading_cleanup(*self._threads)
|
||||
threading_helper.threading_cleanup(*self._threads)
|
||||
support.reap_children()
|
||||
|
||||
def assertTimeout(self, actual, expected):
|
||||
|
@ -239,7 +240,7 @@ class LockTests(BaseLockTests):
|
|||
lock.acquire()
|
||||
phase.append(None)
|
||||
|
||||
with support.wait_threads_exit():
|
||||
with threading_helper.wait_threads_exit():
|
||||
start_new_thread(f, ())
|
||||
while len(phase) == 0:
|
||||
_wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue