mirror of https://github.com/python/cpython
Issue #19946: use public API for multiprocessing start methods
This should appease the OpenIndiana buildbot. Also lengthened the worst case timeout to try to eliminate the inconsistent failure on one of the Windows 7 buildbots.
This commit is contained in:
parent
9ba75db3c5
commit
05385292e9
|
@ -15,9 +15,9 @@ from test.script_helper import (
|
||||||
assert_python_ok, assert_python_failure, temp_dir,
|
assert_python_ok, assert_python_failure, temp_dir,
|
||||||
spawn_python, kill_python)
|
spawn_python, kill_python)
|
||||||
|
|
||||||
# We look inside the context module to find out which
|
# Look up which start methods are available to test
|
||||||
# start methods we can check
|
import multiprocessing
|
||||||
from multiprocessing.context import _concrete_contexts
|
AVAILABLE_START_METHODS = set(multiprocessing.get_all_start_methods())
|
||||||
|
|
||||||
verbose = support.verbose
|
verbose = support.verbose
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ if __name__ == '__main__':
|
||||||
p = Pool(5)
|
p = Pool(5)
|
||||||
results = []
|
results = []
|
||||||
p.map_async(f, [1, 2, 3], callback=results.extend)
|
p.map_async(f, [1, 2, 3], callback=results.extend)
|
||||||
deadline = time.time() + 2 # up to 2 s to report the results
|
deadline = time.time() + 5 # up to 5 s to report the results
|
||||||
while not results:
|
while not results:
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
if time.time() > deadline:
|
if time.time() > deadline:
|
||||||
|
@ -79,7 +79,7 @@ set_start_method(start_method)
|
||||||
p = Pool(5)
|
p = Pool(5)
|
||||||
results = []
|
results = []
|
||||||
p.map_async(int, [1, 4, 9], callback=results.extend)
|
p.map_async(int, [1, 4, 9], callback=results.extend)
|
||||||
deadline = time.time() + 2 # up to 2 s to report the results
|
deadline = time.time() + 5 # up to 5 s to report the results
|
||||||
while not results:
|
while not results:
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
if time.time() > deadline:
|
if time.time() > deadline:
|
||||||
|
@ -131,7 +131,7 @@ class MultiProcessingCmdLineMixin():
|
||||||
maxDiff = None # Show full tracebacks on subprocess failure
|
maxDiff = None # Show full tracebacks on subprocess failure
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
if self.start_method not in _concrete_contexts:
|
if self.start_method not in AVAILABLE_START_METHODS:
|
||||||
self.skipTest("%r start method not available" % self.start_method)
|
self.skipTest("%r start method not available" % self.start_method)
|
||||||
|
|
||||||
def _check_output(self, script_name, exit_code, out, err):
|
def _check_output(self, script_name, exit_code, out, err):
|
||||||
|
|
Loading…
Reference in New Issue