added sandbox and bash tool

This commit is contained in:
2026-02-20 20:00:52 -07:00
parent 8b62f946ca
commit 93ce413c9b
10 changed files with 419 additions and 11 deletions
+26
View File
@@ -54,3 +54,29 @@ def sample_history():
{"role": "assistance", "content": "Hi there!"},
{"role": "user", "content": "What's 2+2?"},
]
@pytest.fixture
def mock_sandbox():
"""Mock sandbox for unit tests."""
sandbox = MagicMock()
sandbox.run = AsyncMock(return_value="mock output\n")
return sandbox
@pytest.fixture
def crashed_sandbox():
"""Mock sandbox that simulates a crash."""
sandbox = MagicMock()
sandbox.run = AsyncMock(side_effect=RuntimeError("Container crashed unexpectedly"))
return sandbox
@pytest.fixture
def mock_podman_client():
"""Mock Podman client for unit tests."""
with patch("sandbox.session.podman.PodmanClient") as mock:
mock_container = MagicMock()
mock_container.exec_run.return_value = (0, b"mock output\n")
mock.return_value.containers.run.return_value = mock_container
yield mock, mock_container