diff --git a/bin/test_python_floor.py b/bin/test_python_floor.py index 1c5e0ef4..65826d66 100644 --- a/bin/test_python_floor.py +++ b/bin/test_python_floor.py @@ -9,11 +9,15 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] FLOOR = re.compile(r"Python 3\.(\d+) or newer") +def readme_floor() -> tuple[int, int] | None: + named = FLOOR.search((ROOT / "README.md").read_text(encoding="utf-8")) + return (3, int(named.group(1))) if named else None + + class PythonFloor(unittest.TestCase): def test_the_suite_passes_on_the_python_the_readme_names_as_floor(self): - named = FLOOR.search((ROOT / "README.md").read_text(encoding="utf-8")) - self.assertIsNotNone(named, "README.md's Install names `Python 3.N or newer`") - floor = (3, int(named.group(1))) + floor = readme_floor() + self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`") if sys.version_info[:2] == floor: self.skipTest("this run is on the floor") if shutil.which("uv") is None: diff --git a/bin/test_types.py b/bin/test_types.py new file mode 100644 index 00000000..4cc1ba75 --- /dev/null +++ b/bin/test_types.py @@ -0,0 +1,16 @@ +import shutil +import subprocess +import unittest + +from test_python_floor import ROOT, readme_floor + + +class Types(unittest.TestCase): + def test_mypy_passes_on_loop_claude_at_the_floor(self): + floor = readme_floor() + self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`") + if shutil.which("uv") is None: + self.fail("uv on PATH fetches mypy; see README.md's Test line") + version = "%d.%d" % floor + ran = subprocess.run(["uv", "tool", "run", "--python", version, "mypy==2.3.1", "--check-untyped-defs", "--python-version", version, "-p", "loop_claude"], capture_output=True, cwd=ROOT / "bin", text=True) + self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr)