Skip to content

Commit a2a8466

Browse files
gh-154272: Skip more forkserver tests if the start method is unavailable (GH-154499)
Two tests were still not skipped: they were only guarded against Cygwin and Windows. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3479e45 commit a2a8466

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Lib/test/test_concurrent_futures/test_init.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import contextlib
22
import logging
3+
import multiprocessing
34
import queue
45
import time
56
import unittest
@@ -147,8 +148,8 @@ def test_spawn(self):
147148
self._test(ProcessPoolSpawnFailingInitializerTest)
148149

149150
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
150-
@unittest.skipIf(sys.platform == "cygwin",
151-
"Forkserver is not available on Cygwin")
151+
@unittest.skipUnless("forkserver" in multiprocessing.get_all_start_methods(),
152+
"forkserver start method is not available")
152153
def test_forkserver(self):
153154
self._test(ProcessPoolForkserverFailingInitializerTest)
154155

Lib/test/test_profiling/test_tracing_profiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test suite for the cProfile module."""
2+
import multiprocessing
23
import sys
34
import unittest
45

@@ -220,8 +221,8 @@ def test_process_spawn_pickle(self):
220221
# gh-140729: test use Process in cProfile.
221222
self._test_process_run_pickle('spawn')
222223

223-
@unittest.skipIf(sys.platform == 'win32',
224-
"No 'forkserver' start method on Windows")
224+
@unittest.skipUnless("forkserver" in multiprocessing.get_all_start_methods(),
225+
"forkserver start method is not available")
225226
def test_process_forkserver_pickle(self):
226227
# gh-140729: test use Process in cProfile.
227228
self._test_process_run_pickle('forkserver')

0 commit comments

Comments
 (0)