[3.12] gh-108388: Split test_multiprocessing_spawn (GH-108396) (#108442)

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-08-25 09:15:53 -07:00 committed by GitHub
parent 09487a202f
commit 22621907ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 117 additions and 27 deletions

View file

@ -6088,7 +6088,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'}
@ -6101,6 +6102,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):
@ -6111,6 +6116,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