From 010ceb6ba516c0e905bb5fa68910a4e1bb9958a4 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 12 Jun 2025 10:51:07 +0200 Subject: [PATCH] Avoid the multiprocessing forkserver method The default method has changed in Python 3.14: https://docs.python.org/dev/whatsnew/3.14.html#whatsnew314-multiprocessing-start-method --- test/mod/test_api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/mod/test_api.py b/test/mod/test_api.py index 6b029311..02fb66d7 100644 --- a/test/mod/test_api.py +++ b/test/mod/test_api.py @@ -83,7 +83,17 @@ class TestAPI(unittest.TestCase): api = osbuild.api.API(socket_address=path) with api: - p = mp.Process(target=exception, args=(path, )) + # On macOS and newly non-macOS POSIX systems (since Python 3.14), + # the default method has been changed to forkserver. + # The code in this module does not work with it, + # hence the explicit change to 'fork' + # See https://github.com/python/cpython/issues/125714 + if mp.get_start_method() == "forkserver": + _mp_context = mp.get_context(method="fork") + else: + _mp_context = mp.get_context() + + p = _mp_context.Process(target=exception, args=(path, )) p.start() p.join() self.assertEqual(p.exitcode, 2)