summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threaded_import.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-01 10:06:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-01 10:06:18 (GMT)
commitc05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b (patch)
treefb71efc4179189df04b94d4f0e7d628b2cee62b0 /Lib/test/test_threaded_import.py
parenta7726624239367a72f5117700e675d5915a40714 (diff)
parent263dcd20a374d540c8f0bc07332f1657adf6da83 (diff)
downloadcpython-c05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b.zip
cpython-c05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b.tar.gz
cpython-c05e260ecb822431cf5bdcd02b7cb0f4cfc88f6b.tar.bz2
Issue #23799: Added test.support.start_threads() for running and cleaning up
multiple threads.
Diffstat (limited to 'Lib/test/test_threaded_import.py')
-rw-r--r--Lib/test/test_threaded_import.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 5bf670c..9b2d9a6 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -14,7 +14,7 @@ import shutil
import unittest
from test.support import (
verbose, import_module, run_unittest, TESTFN, reap_threads,
- forget, unlink, rmtree)
+ forget, unlink, rmtree, start_threads)
threading = import_module('threading')
def task(N, done, done_tasks, errors):
@@ -116,10 +116,10 @@ class ThreadedImportTests(unittest.TestCase):
done_tasks = []
done.clear()
t0 = time.monotonic()
- for i in range(N):
- t = threading.Thread(target=task,
- args=(N, done, done_tasks, errors,))
- t.start()
+ with 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
if verbose: