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

Function test_uv_run_with_ephemeral_dependency

e2e/python/test_sandbox_venv.py:104–126  ·  view source on GitHub ↗

uv run --with installs a dependency on-the-fly and runs a script using it.

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

Source from the content-addressed store, hash-verified

102
103
104def test_uv_run_with_ephemeral_dependency(
105 sandbox: Callable[..., Sandbox],
106) -> None:
107 """uv run --with installs a dependency on-the-fly and runs a script using it."""
108 with sandbox(delete_on_exit=True) as sb:
109 result = sb.exec(
110 [
111 "uv",
112 "run",
113 "--python",
114 "/sandbox/.venv/bin/python",
115 "--with",
116 "cowsay",
117 "python",
118 "-c",
119 "import cowsay; print(cowsay.char_names[0])",
120 ],
121 timeout_seconds=60,
122 )
123 assert result.exit_code == 0, (
124 f"uv run --with failed:\nstdout: {result.stdout}\nstderr: {result.stderr}"
125 )
126 assert result.stdout.strip(), "Expected non-empty output from uv run"

Callers

nothing calls this directly

Calls 2

sandboxFunction · 0.70
execMethod · 0.45

Tested by

no test coverage detected