diff --git a/Lib/test/test_os/test_os.py b/Lib/test/test_os/test_os.py index 3cab8ff9536d23..06f69caad12bc8 100644 --- a/Lib/test/test_os/test_os.py +++ b/Lib/test/test_os/test_os.py @@ -2824,7 +2824,8 @@ def test_negative_fd_ebadf(self, fd): func(*args) self.assertEqual(ctx.exception.errno, errno.EBADF) - if hasattr(os, "execve") and os.execve in os.supports_fd: + if (hasattr(os, "execve") and os.execve in os.supports_fd + and support.has_subprocess_support): # glibc fails with EINVAL, musl fails with EBADF with self.assertRaises(OSError) as ctx: os.execve(fd, [sys.executable, "-c", "pass"], os.environ)