test(exec): isolate Windows platform mock

This commit is contained in:
chengyongru
2026-08-12 14:37:27 +08:00
committed by chengyongru
parent a6193932a0
commit 1656664a47
+1 -1
View File
@@ -160,7 +160,7 @@ class TestSpawnWindows:
with ( with (
patch("nanobot.agent.tools.shell._IS_WINDOWS", True), patch("nanobot.agent.tools.shell._IS_WINDOWS", True),
patch("nanobot.agent.tools.shell.sys.platform", "win32"), patch("nanobot.agent.tools.shell.sys", MagicMock(platform="win32")),
patch("asyncio.create_subprocess_exec", new_callable=AsyncMock) as mock_exec, patch("asyncio.create_subprocess_exec", new_callable=AsyncMock) as mock_exec,
patch.object(ExecTool, "_create_windows_job", return_value=job), patch.object(ExecTool, "_create_windows_job", return_value=job),
pytest.raises(OSError, match="OpenProcess failed"), pytest.raises(OSError, match="OpenProcess failed"),