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