Skip to content

Commit cd2db4d

Browse files
serhiy-storchakaclaude
authored andcommitted
gh-154272: Skip forkserver tests when the start method is unavailable (GH-154274)
(cherry picked from commit 13e3f8a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e8206b6 commit cd2db4d

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Lib/test/test_concurrent_futures/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def get_context(self):
139139
self.skipTest("require unix system")
140140
if support.check_sanitizer(thread=True):
141141
self.skipTest("TSAN doesn't support threads after fork")
142+
if "forkserver" not in multiprocessing.get_all_start_methods():
143+
self.skipTest("forkserver start method is not available")
142144
return super().get_context()
143145

144146
def create_event(self):

Lib/test/test_multiprocessing_forkserver/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import multiprocessing
12
import os.path
23
import sys
34
import unittest
@@ -12,5 +13,10 @@
1213
if not support.has_fork_support:
1314
raise unittest.SkipTest("requires working os.fork()")
1415

16+
# The forkserver start method requires passing file descriptors over a Unix
17+
# socket, which is not available on every platform (e.g. Solaris/illumos).
18+
if "forkserver" not in multiprocessing.get_all_start_methods():
19+
raise unittest.SkipTest("forkserver start method is not available")
20+
1521
def load_tests(*args):
1622
return support.load_package_tests(os.path.dirname(__file__), *args)

0 commit comments

Comments
 (0)