MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / test_pip_install_in_sandbox

Function test_pip_install_in_sandbox

e2e/python/test_sandbox_venv.py:42–63  ·  view source on GitHub ↗

pip install works inside the sandbox and installed packages are importable.

(
    sandbox: Callable[..., Sandbox],
)

Source from the content-addressed store, hash-verified

40
41
42def test_pip_install_in_sandbox(
43 sandbox: Callable[..., Sandbox],
44) -> None:
45 """pip install works inside the sandbox and installed packages are importable."""
46 with sandbox(delete_on_exit=True) as sb:
47 install = sb.exec(
48 ["pip", "install", "--quiet", "cowsay"],
49 timeout_seconds=60,
50 )
51 assert install.exit_code == 0, (
52 f"pip install failed:\nstdout: {install.stdout}\nstderr: {install.stderr}"
53 )
54
55 # Verify the package is importable
56 verify = sb.exec(
57 ["python", "-c", "import cowsay; print(cowsay.char_names[0])"],
58 timeout_seconds=20,
59 )
60 assert verify.exit_code == 0, (
61 f"import failed:\nstdout: {verify.stdout}\nstderr: {verify.stderr}"
62 )
63 assert verify.stdout.strip(), "Expected non-empty output from cowsay"
64
65
66def test_uv_pip_install_in_sandbox(

Callers

nothing calls this directly

Calls 2

sandboxFunction · 0.70
execMethod · 0.45

Tested by

no test coverage detected