Check for uv before running the floor suite, so its message is the only line
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -16,8 +17,7 @@ class PythonFloor(unittest.TestCase):
|
|||||||
named = FLOOR.search((ROOT / "README.md").read_text(encoding="utf-8"))
|
named = FLOOR.search((ROOT / "README.md").read_text(encoding="utf-8"))
|
||||||
self.assertIsNotNone(named, "README.md's Install names `Python 3.N or newer`")
|
self.assertIsNotNone(named, "README.md's Install names `Python 3.N or newer`")
|
||||||
suite = ["python", "-m", "unittest", "discover", "-s", "bin", "-p", "test_*.py"]
|
suite = ["python", "-m", "unittest", "discover", "-s", "bin", "-p", "test_*.py"]
|
||||||
try:
|
if shutil.which("uv") is None:
|
||||||
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:
|
|
||||||
self.fail("uv on PATH fetches the floor interpreter; see README.md's Test line")
|
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)
|
self.assertEqual(ran.returncode, 0, ran.stderr)
|
||||||
|
|||||||
Reference in New Issue
Block a user