diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-01 10:01:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-01 10:01:14 (GMT) |
commit | 263dcd20a374d540c8f0bc07332f1657adf6da83 (patch) | |
tree | c44955a3ff494353583163d4634cae512e7836dc /Lib/test/test_threaded_import.py | |
parent | 8218bd4caf683ee98c450a093bf171dbca6c4849 (diff) | |
download | cpython-263dcd20a374d540c8f0bc07332f1657adf6da83.zip cpython-263dcd20a374d540c8f0bc07332f1657adf6da83.tar.gz cpython-263dcd20a374d540c8f0bc07332f1657adf6da83.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.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index 192fa08..4be615a 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): @@ -115,10 +115,10 @@ class ThreadedImportTests(unittest.TestCase): errors = [] done_tasks = [] done.clear() - 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 self.assertTrue(done.wait(60)) self.assertFalse(errors) if verbose: |