summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-08-25 16:15:53 (GMT)
committerGitHub <noreply@github.com>2023-08-25 16:15:53 (GMT)
commit22621907eea3f0ed4ccf5a69bcef70a70396b36b (patch)
treeb333c3cfb7e55c17d57fc0f74d861224eec3160b /Lib/test/_test_multiprocessing.py
parent09487a202fdcbc94089794ad80158d3847d4a6f8 (diff)
downloadcpython-22621907eea3f0ed4ccf5a69bcef70a70396b36b.zip
cpython-22621907eea3f0ed4ccf5a69bcef70a70396b36b.tar.gz
cpython-22621907eea3f0ed4ccf5a69bcef70a70396b36b.tar.bz2
[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 aa9a359ca2663195b0f04eef46109c28c4ff74d3) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r--Lib/test/_test_multiprocessing.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 1afb873..19e1086 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -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