Am 10.07.2026 um 18:13 hat Denis V. Lunev geschrieben:
> run_tests_pool() shares the runner via the class attribute
> TestRunner.shared_self, relying on worker processes to inherit it.
> That only works with the 'fork' start method. Python 3.14 switched
> the Linux default to 'forkserver', so workers see shared_self as
> None and parallel runs abort with:
>
> assert runner is not None
> AssertionError
>
> Only reproduces with Python 3.14+ and 'check -jN' (N > 1); meson
> runs one test per process and never calls run_tests_pool(), so CI
> is unaffected.
>
> Request get_context('fork') explicitly; it is available on all
> supported Python versions and a no-op before 3.14.
>
> Signed-off-by: Denis V. Lunev <[email protected]>
> CC: Kevin Wolf <[email protected]>
> CC: Hanna Reitz <[email protected]>
> ---
> tests/qemu-iotests/testrunner.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/testrunner.py
> b/tests/qemu-iotests/testrunner.py
> index dbe2dddc32..5b2664d9f3 100644
> --- a/tests/qemu-iotests/testrunner.py
> +++ b/tests/qemu-iotests/testrunner.py
> @@ -26,7 +26,7 @@
> import json
> import shutil
> import sys
> -from multiprocessing import Pool
> +from multiprocessing import Pool, get_context
> from typing import List, Optional, Any, Sequence, Dict
> from testenv import TestEnv
>
> @@ -125,7 +125,7 @@ def run_tests_pool(self, tests: List[str],
> assert TestRunner.shared_self is None
> TestRunner.shared_self = self
>
> - with Pool(jobs) as p:
> + with get_context('fork').Pool(jobs) as p:
> results = p.starmap(self.proc_run_test,
> zip(tests, [test_field_width] * len(tests)))
Makes sense, but the Pool import is now unused:
=== pylint ===
+************* Module testrunner
+testrunner.py:29:0: W0611: Unused Pool imported from multiprocessing
(unused-import)
=== mypy ===
Kevin