From 7ef4ff95b053b6300f4be497209968783a770a4d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 26 Sep 2026 15:22:15 +0200 Subject: [PATCH] Test that every bin/ file compiles on the Python the decision log names as the floor --- bin/test_loop_claude.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index 99de1d55..35443e2a 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -6,6 +6,7 @@ import io import json import os import pathlib +import re import stat import subprocess import sys @@ -30,6 +31,18 @@ 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"