Files
microsoft--magentic-ui/tests/test_sandbox_guest_tools_dir.py
wehub-resource-sync 25576b0be6
Checks (magui2.0) / python-lint (push) Failing after 1s
Checks (magui2.0) / python-test (push) Failing after 0s
Checks (magui2.0) / frontend-lint (push) Failing after 0s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
Checks (magui2.0) / python-format (push) Failing after 1s
CodeQL Advanced / Analyze (python) (push) Failing after 0s
Checks (magui2.0) / python-pyright (push) Failing after 1s
Checks (magui2.0) / frontend-format (push) Failing after 1s
Checks (magui2.0) / frontend-typecheck (push) Failing after 0s
Checks (magui2.0) / frontend-test (push) Failing after 2s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
chore: import upstream snapshot with attribution
2026-07-13 12:24:32 +08:00

41 lines
1.6 KiB
Python

"""Sandbox.guest_tools_dir wiring — each backend exposes a path that the
agent shell can use to locate magui_tools and scripts/search.sh."""
from __future__ import annotations
from pathlib import Path
import pytest
from magentic_ui.sandbox._null import NullSandbox
class TestNullSandboxGuestToolsDir:
def test_points_at_host_source_dir_with_magui_tools(self, tmp_path: Path) -> None:
sb = NullSandbox(workspace=tmp_path)
tools_dir = Path(sb.guest_tools_dir)
# Must be an absolute, existing directory on the host.
assert tools_dir.is_absolute()
assert tools_dir.is_dir(), f"NullSandbox.guest_tools_dir not a dir: {tools_dir}"
# Must contain both pieces _registry.py invokes:
# 1. magui_tools/ package (loaded via PYTHONPATH=...)
# 2. scripts/search.sh (sourced for search_dir/search_file/find_file)
assert (tools_dir / "magui_tools" / "__init__.py").is_file()
assert (tools_dir / "scripts" / "search.sh").is_file()
class TestQuicksandSandboxGuestToolsDir:
def test_matches_in_vm_mount_point(self) -> None:
# The quicksand third-party package is only installed via the
# `setup-sandbox` poe task, not by `uv sync` — skip when absent
# (e.g. CI's python-test job).
pytest.importorskip("quicksand")
from magentic_ui.sandbox._quicksand import QuicksandSandbox
sb = QuicksandSandbox()
# QuicksandSandbox advertises the in-VM mount path; the actual
# mount happens in __aenter__ which we don't run here.
assert sb.guest_tools_dir == "/usr/local/lib/magui"