@@ -3348,6 +3348,7 @@ def exit_handler():
33483348 @unittest .skipIf (not sysconfig .get_config_var ("HAVE_VFORK" ),
33493349 "vfork() not enabled by configure." )
33503350 @mock .patch ("subprocess._fork_exec" )
3351+ @mock .patch ("subprocess._USE_POSIX_SPAWN" , new = False )
33513352 def test__use_vfork (self , mock_fork_exec ):
33523353 self .assertTrue (subprocess ._USE_VFORK ) # The default value regardless.
33533354 mock_fork_exec .side_effect = RuntimeError ("just testing args" )
@@ -3366,9 +3367,13 @@ def test__use_vfork(self, mock_fork_exec):
33663367 @unittest .skipIf (not sysconfig .get_config_var ("HAVE_VFORK" ),
33673368 "vfork() not enabled by configure." )
33683369 @unittest .skipIf (sys .platform != "linux" , "Linux only, requires strace." )
3370+ @mock .patch ("subprocess._USE_POSIX_SPAWN" , new = False )
33693371 def test_vfork_used_when_expected (self ):
33703372 # This is a performance regression test to ensure we default to using
33713373 # vfork() when possible.
3374+ # Technically this test could pass when posix_spawn is used as well
3375+ # because libc tends to implement that internally using vfork. But
3376+ # that'd just be testing a libc+kernel implementation detail.
33723377 strace_binary = "/usr/bin/strace"
33733378 # The only system calls we are interested in.
33743379 strace_filter = "--trace=clone,clone2,clone3,fork,vfork,exit,exit_group"
0 commit comments