Check for uv before running the floor suite, so its message is the only line

This commit is contained in:
2026-09-27 14:34:27 +02:00
parent 9f8b413d51
commit cb3bc8b3e1
+3 -3
View File
@@ -1,6 +1,7 @@
import os
import pathlib
import re
import shutil
import subprocess
import unittest
@@ -16,8 +17,7 @@ class PythonFloor(unittest.TestCase):
named = FLOOR.search((ROOT / "README.md").read_text(encoding="utf-8"))
self.assertIsNotNone(named, "README.md's Install names `Python 3.N or newer`")
suite = ["python", "-m", "unittest", "discover", "-s", "bin", "-p", "test_*.py"]
try:
ran = subprocess.run(["uv", "run", "--no-project", "--python", named.group(1), *suite], capture_output=True, cwd=ROOT, env={**os.environ, ON_FLOOR: "1"}, text=True)
except FileNotFoundError:
if shutil.which("uv") is None:
self.fail("uv on PATH fetches the floor interpreter; see README.md's Test line")
ran = subprocess.run(["uv", "run", "--no-project", "--python", named.group(1), *suite], capture_output=True, cwd=ROOT, env={**os.environ, ON_FLOOR: "1"}, text=True)
self.assertEqual(ran.returncode, 0, ran.stderr)