mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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
|
@ -7,6 +7,7 @@ import threading
|
|||
import weakref
|
||||
|
||||
from test import support
|
||||
from test.support import threading_helper
|
||||
from test import lock_tests
|
||||
|
||||
|
||||
|
@ -138,7 +139,7 @@ class LifetimeTests:
|
|||
) = test_util.test_both(LifetimeTests, init=init)
|
||||
|
||||
|
||||
@support.reap_threads
|
||||
@threading_helper.reap_threads
|
||||
def test_main():
|
||||
support.run_unittest(Frozen_ModuleLockAsRLockTests,
|
||||
Source_ModuleLockAsRLockTests,
|
||||
|
|
|
@ -15,8 +15,9 @@ import threading
|
|||
import unittest
|
||||
from unittest import mock
|
||||
from test.support import (
|
||||
verbose, run_unittest, TESTFN, reap_threads,
|
||||
forget, unlink, rmtree, start_threads)
|
||||
verbose, run_unittest, TESTFN,
|
||||
forget, unlink, rmtree)
|
||||
from test.support import threading_helper
|
||||
|
||||
def task(N, done, done_tasks, errors):
|
||||
try:
|
||||
|
@ -124,9 +125,9 @@ class ThreadedImportTests(unittest.TestCase):
|
|||
done_tasks = []
|
||||
done.clear()
|
||||
t0 = time.monotonic()
|
||||
with start_threads(threading.Thread(target=task,
|
||||
args=(N, done, done_tasks, errors,))
|
||||
for i in range(N)):
|
||||
with threading_helper.start_threads(
|
||||
threading.Thread(target=task, args=(N, done, done_tasks, errors,))
|
||||
for i in range(N)):
|
||||
pass
|
||||
completed = done.wait(10 * 60)
|
||||
dt = time.monotonic() - t0
|
||||
|
@ -245,7 +246,7 @@ class ThreadedImportTests(unittest.TestCase):
|
|||
del sys.modules[TESTFN]
|
||||
|
||||
|
||||
@reap_threads
|
||||
@threading_helper.reap_threads
|
||||
def test_main():
|
||||
old_switchinterval = None
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue