diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index 35443e2a..99de1d55 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -6,7 +6,6 @@ import io import json import os import pathlib -import re import stat import subprocess import sys @@ -31,18 +30,6 @@ def human(content): return {"type": "user", "message": {"content": content}} -class PythonFloor(unittest.TestCase): - def test_every_bin_file_compiles_on_the_python_the_decision_log_names(self): - root = pathlib.Path(__file__).resolve().parents[1] - named = re.search(r"^## bin/: parses on Python (3\.\d+)$", (root / "docs" / "decisions.md").read_text(), re.MULTILINE) - self.assertIsNotNone(named, "docs/decisions.md heads the floor `bin/: parses on Python 3.N`") - tracked = subprocess.run(["git", "ls-files", "-z", "bin"], capture_output=True, check=True, cwd=root, text=True).stdout.split("\0") - self.assertTrue(tracked[0]) - check = "import sys\nfor path in sys.argv[1:]:\n\tcompile(open(path).read(), path, 'exec')" - compiled = subprocess.run(["uv", "run", "--no-project", "--python", named.group(1), "python", "-c", check, *filter(None, tracked)], capture_output=True, cwd=root, text=True) - self.assertEqual(compiled.returncode, 0, compiled.stderr) - - class Sections(unittest.TestCase): def test_keeps_every_headed_section_with_its_bodies(self): text = "# Title\n\nintro\n\n## Goals\n\n1. one\n```sh\n# not a heading\n```\n### Later\n2. two\n#1 priority\n\n## Empty\n\n## Audience\nme\n## Audience\nagain\n# Appendix\nnot audience\n" diff --git a/bin/test_python_floor.py b/bin/test_python_floor.py new file mode 100644 index 00000000..4a29aefd --- /dev/null +++ b/bin/test_python_floor.py @@ -0,0 +1,18 @@ +import pathlib +import re +import subprocess +import unittest + +ROOT = pathlib.Path(__file__).resolve().parents[1] +FLOOR = re.compile(r"Python (3\.\d+) or newer") + + +class PythonFloor(unittest.TestCase): + def test_every_bin_file_compiles_on_the_python_the_readme_names_as_floor(self): + named = FLOOR.search((ROOT / "README.md").read_text()) + self.assertIsNotNone(named, "README.md's Install names `Python 3.N or newer`") + tracked = subprocess.run(["git", "ls-files", "-z", "bin"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0") + self.assertTrue(tracked[0]) + check = "import sys\nfor path in sys.argv[1:]:\n\tcompile(open(path).read(), path, 'exec')" + compiled = subprocess.run(["uv", "run", "--no-project", "--python", named.group(1), "python", "-c", check, *filter(None, tracked)], capture_output=True, cwd=ROOT, text=True) + self.assertEqual(compiled.returncode, 0, compiled.stderr)