[3.11] gh-108388: Split test_multiprocessing_spawn (GH-108396) (#109688)

gh-108388: Split test_multiprocessing_spawn (GH-108396)

Split test_multiprocessing_fork, test_multiprocessing_forkserver and
test_multiprocessing_spawn into test packages. Each package is made
of 4 sub-tests: processes, threads, manager and misc. It allows
running more tests in parallel and so reduce the total test duration.
(cherry picked from commit aa9a359ca2)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2023-09-21 13:44:21 -07:00 committed by GitHub
parent 8d99502aac
commit b3af888342
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 117 additions and 27 deletions

View file

@ -6080,7 +6080,8 @@ class ThreadsMixin(BaseMixin):
# Functions used to create test cases from the base ones in this module
#
def install_tests_in_module_dict(remote_globs, start_method):
def install_tests_in_module_dict(remote_globs, start_method,
only_type=None, exclude_types=False):
__module__ = remote_globs['__name__']
local_globs = globals()
ALL_TYPES = {'processes', 'threads', 'manager'}
@ -6093,6 +6094,10 @@ def install_tests_in_module_dict(remote_globs, start_method):
continue
assert set(base.ALLOWED_TYPES) <= ALL_TYPES, base.ALLOWED_TYPES
for type_ in base.ALLOWED_TYPES:
if only_type and type_ != only_type:
continue
if exclude_types:
continue
newname = 'With' + type_.capitalize() + name[1:]
Mixin = local_globs[type_.capitalize() + 'Mixin']
class Temp(base, Mixin, unittest.TestCase):
@ -6103,6 +6108,9 @@ def install_tests_in_module_dict(remote_globs, start_method):
Temp.__module__ = __module__
remote_globs[newname] = Temp
elif issubclass(base, unittest.TestCase):
if only_type:
continue
class Temp(base, object):
pass
Temp.__name__ = Temp.__qualname__ = name