Skip to content

Commit 5e0158c

Browse files
committed
Enhance test case setup, skip if get_start_method() is not set to 'fork'
1 parent 9c8f303 commit 5e0158c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6844,21 +6844,21 @@ def f(x): return x*x
68446844
self.assertEqual("332833500", out.decode('utf-8').strip())
68456845
self.assertFalse(err, msg=err.decode('utf-8'))
68466846

6847-
@support.requires_fork()
6848-
def test_forked_not_started(self):
6849-
# gh-134381
6850-
# Ensure that a forked parent process, which has not been started yet,
6851-
# can be initiated within the child process.
6852-
6853-
ctx = multiprocessing.get_context("fork") # local “fork” cont
6854-
q = ctx.Queue()
6847+
def test_forked_thread_not_started(self):
6848+
# gh-134381: Ensure that a thread that has not been started yet in
6849+
# the parent process can be started within a forked child process.
6850+
6851+
if multiprocessing.get_start_method() != "fork":
6852+
self.skipTest("fork specific test")
6853+
6854+
q = multiprocessing.Queue()
68556855
t = threading.Thread(target=lambda: q.put("done"), daemon=True)
68566856

68576857
def child():
68586858
t.start()
68596859
t.join()
68606860

6861-
p = ctx.Process(target=child)
6861+
p = multiprocessing.Process(target=child)
68626862
p.start()
68636863
p.join(support.SHORT_TIMEOUT)
68646864

0 commit comments

Comments
 (0)