From 3a8dc8225134a22085097220232365db59278523 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:47:44 +0800 Subject: [PATCH] test(shell): use native paths in sandbox platform fixture --- tests/tools/test_exec_platform.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/tools/test_exec_platform.py b/tests/tools/test_exec_platform.py index 496c1e2e6..d8472288a 100644 --- a/tests/tools/test_exec_platform.py +++ b/tests/tools/test_exec_platform.py @@ -524,12 +524,13 @@ class TestSandboxPlatform: @pytest.mark.asyncio @pytest.mark.parametrize("backend", ["bwrap", "seatbelt"]) - async def test_sandbox_applied_on_unix(self, backend): + async def test_sandbox_applied_on_unix(self, tmp_path, backend): mock_proc = _CompletedProcess(b"sandboxed") + trusted_bin = tmp_path / "trusted-bin" with ( patch("nanobot.agent.tools.shell._IS_WINDOWS", False), - patch("nanobot.agent.tools.shell.shutil.which", side_effect=lambda name, **_kwargs: f"/usr/bin/{name}"), + patch("nanobot.agent.tools.shell.shutil.which", side_effect=lambda name, **_kwargs: str(trusted_bin / name)), patch("nanobot.agent.tools.shell.wrap_command", return_value=f"{backend} -- sh -c ls") as mock_wrap, patch.object(ExecTool, "_spawn", return_value=mock_proc) as mock_spawn, patch.object(ExecTool, "_guard_command", return_value=None), @@ -540,7 +541,7 @@ class TestSandboxPlatform: mock_wrap.assert_called_once() spawned_cmd = mock_spawn.call_args[0][0] assert isinstance(spawned_cmd, list) - assert spawned_cmd[0] == f"/usr/bin/{backend}" + assert spawned_cmd[0] == str(trusted_bin / backend) @pytest.mark.asyncio @pytest.mark.parametrize("backend", ["bwrap", "seatbelt"])