Test held() and the breaches a commit in the config's folder reports

This commit is contained in:
2026-11-13 02:03:07 +01:00
parent 583da20cbd
commit c180bda54b
2 changed files with 27 additions and 1 deletions
+11
View File
@@ -935,6 +935,7 @@ class TodoRankCheck(unittest.TestCase):
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
(self.config.parent / "todo.md").write_text("# todo\n")
self.assertEqual(self.details(folder), [f"own script checked {folder}/todo.md"], "checked with the checkout's own rank_todo.py, as a commit there would be")
self.assertEqual([(breach.rule, breach.directory) for breach in todo_breaches(folder, pathlib.Path(self.own))], [("todo-rank-check", str(pathlib.Path(folder).resolve()))])
git(folder, "add", "-A")
git(folder, "commit", "-q", "-m", "plan")
self.assertEqual(self.details(folder), [], "committed, so unchanged")
@@ -942,6 +943,16 @@ class TodoRankCheck(unittest.TestCase):
(self.config.parent / "todo.md").write_text("# changed\n")
self.assertEqual(self.details(folder), [], "a config to fix doesn't block the commit that fixes it")
def test_a_commit_in_the_configs_folder_of_another_repo_checks_its_plan_with_the_hooks_ranking(self):
self.changed_plan(self.other, self.STUB)
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
folder = str(self.config.parent)
git(folder, "init", "-q", "-b", "main")
(self.config.parent / "todo.md").write_text("# todo\n")
reasons = self.details(folder)
self.assertTrue(reasons)
self.assertNotIn("own script", " ".join(reasons))
def test_a_plan_in_a_folder_of_the_checkout_is_checked_once_it_changes(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"checkout:plan/todo.md"'))