summaryrefslogtreecommitdiff
path: root/Lib/test/test_capi.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-01 13:06:18 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-01 13:06:18 +0300
commit4226c77ac8e05879541a91ae4587deb5ebc29952 (patch)
treec0eb452a4c30f29b00c92dde6407a699b252bc8a /Lib/test/test_capi.py
parent11c9327643ba02b6da28dee489172cb79d580868 (diff)
parent8472f0e33d2d7dea7f1498351225548f671f22d2 (diff)
downloadcpython-4226c77ac8e05879541a91ae4587deb5ebc29952.tar.gz
Issue #23799: Added test.support.start_threads() for running and cleaning up
multiple threads.
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r--Lib/test/test_capi.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index fbd1466c78..dff717b5e0 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -284,15 +284,11 @@ class TestPendingCalls(unittest.TestCase):
context.lock = threading.Lock()
context.event = threading.Event()
- for i in range(context.nThreads):
- t = threading.Thread(target=self.pendingcalls_thread, args = (context,))
- t.start()
- threads.append(t)
-
- self.pendingcalls_wait(context.l, n, context)
-
- for t in threads:
- t.join()
+ threads = [threading.Thread(target=self.pendingcalls_thread,
+ args=(context,))
+ for i in range(context.nThreads)]
+ with support.start_threads(threads):
+ self.pendingcalls_wait(context.l, n, context)
def pendingcalls_thread(self, context):
try: