Skip to content

Commit 6bc3e6c

Browse files
[3.15] gh-154272: Skip more forkserver tests if the start method is unavailable (GH-154499) (GH-154505)
Two tests were still not skipped: they were only guarded against Cygwin and Windows. (cherry picked from commit a2a8466) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7dca47d commit 6bc3e6c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_concurrent_futures/test_init.py

Lines changed: 3 additions & 0 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,6 +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)
151+
@unittest.skipUnless("forkserver" in multiprocessing.get_all_start_methods(),
152+
"forkserver start method is not available")
150153
def test_forkserver(self):
151154
self._test(ProcessPoolForkserverFailingInitializerTest)
152155

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)