Skip to content

Commit 87e58b7

Browse files
committed
use run_uv everywhere
1 parent 164f0c8 commit 87e58b7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pyperformance/tests/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import tempfile
1010
import unittest
1111

12+
from pyperformance._utils import run_uv
13+
1214
TESTS_ROOT = os.path.realpath(os.path.dirname(__file__))
1315
DATA_DIR = os.path.join(TESTS_ROOT, "data")
1416
REPO_ROOT = os.path.dirname(os.path.dirname(TESTS_ROOT))
@@ -75,14 +77,17 @@ def cleanup():
7577
def cleanup():
7678
return None
7779

78-
uv = shutil.which("uv")
79-
if not uv:
80-
raise RuntimeError("uv executable is required to provision test environments")
81-
argv = [uv, "venv", "--seed"]
80+
argv = ["venv", "--seed"]
8281
if python:
8382
argv.extend(["--python", python])
8483
argv.append(root)
85-
run_cmd(*argv, capture=not verbose, onfail="raise", verbose=verbose)
84+
exitcode, _, _ = run_uv(*argv, capture=not verbose, verbose=verbose)
85+
if exitcode:
86+
if exitcode == 127:
87+
raise RuntimeError(
88+
"uv executable is required to provision test environments"
89+
)
90+
raise RuntimeError(f'"uv {" ".join(argv)}" failed with exit code {exitcode}')
8691
venv_root = os.path.realpath(root)
8792
return venv_root, _resolve_venv_python(venv_root), cleanup
8893

0 commit comments

Comments
 (0)