Skip to content

Commit 7554382

Browse files
committed
scripts/test_runtime_dep_smoketest.py(test[smoke]): add pytest wrapper
why: allow CI to invoke runtime dependency smoke test via pytest marker. what: - add isolated test harness that shells out with uvx to run the script. - echo stdout/stderr when the subprocess fails for easier debugging.
1 parent 58b44d6 commit 7554382

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""Tests for the runtime dependency smoke test script.
2+
3+
These tests are intentionally isolated behind the
4+
``scripts__runtime_dep_smoketest`` marker so they only run when explicitly
5+
requested, e.g. ``pytest -m scripts__runtime_dep_smoketest``.
6+
"""
7+
8+
from __future__ import annotations
9+
10+
import shutil
11+
import subprocess
12+
import sys
13+
from pathlib import Path
14+
15+
import pytest
16+
17+
pytestmark = pytest.mark.scripts__runtime_dep_smoketest
18+
19+
20+
def test_runtime_smoke_test_script() -> None:
21+
"""Run ``scripts/runtime_dep_smoketest.py`` in a clean uvx environment."""
22+
uvx = shutil.which("uvx")
23+
if uvx is None:
24+
pytest.skip("uvx is required to run the runtime dependency smoke test")
25+
26+
repo_root = Path(__file__).resolve().parents[1]
27+
script_path = repo_root / "scripts" / "runtime_dep_smoketest.py"
28+
29+
result = subprocess.run(
30+
[
31+
uvx,
32+
"--isolated",
33+
"--reinstall",
34+
"--from",
35+
str(repo_root),
36+
"python",
37+
str(script_path),
38+
],
39+
capture_output=True,
40+
text=True,
41+
cwd=str(repo_root),
42+
check=False,
43+
)
44+
45+
if result.returncode != 0:
46+
sys.stdout.write(result.stdout)
47+
sys.stderr.write(result.stderr)
48+
49+
assert result.returncode == 0, "runtime dependency smoke test failed"

0 commit comments

Comments
 (0)