Name the next release's items without a Touches list, and warn of them in rank_todo.py --check
CI / tests (pull_request) Successful in 4m24s
CI / tests (pull_request) Successful in 4m24s
This commit is contained in:
+23
-3
@@ -14,6 +14,9 @@ from plan import goals_file, ranking
|
||||
import rank_todo
|
||||
from todo_item.doubles import READABLE_TOUCHES, UNREADABLE_BULLETS
|
||||
|
||||
# What --check says of plan.doubles' TODO, none of whose items of the next release, 0.1.0, holds a list. The order is the ranked table's.
|
||||
UNPREDICTED = "items 4, 3, 2 and 5 of release 0.1.0 have no `Touches:` list; write each as `~/.claude/rules/todo-items.md` says"
|
||||
|
||||
|
||||
class Main(unittest.TestCase):
|
||||
# The home of a test that writes no config.
|
||||
@@ -41,7 +44,7 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(self.run_main("--check", str(todo))[0], 1)
|
||||
self.assertEqual(todo.read_text(), TODO)
|
||||
self.assertEqual(self.run_main(str(todo)), (0, ""))
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (0, f"{todo}: warning: {UNPREDICTED}\n"))
|
||||
pathlib.Path(temp, "README.md").write_bytes(b"\xff")
|
||||
self.assertEqual(self.run_main(str(todo)), (1, f"cannot read {temp}/README.md: not UTF-8 on line 1\n"))
|
||||
pathlib.Path(temp, "README.md").unlink()
|
||||
@@ -62,7 +65,7 @@ class Main(unittest.TestCase):
|
||||
(folder / "decisions.md").write_text(DECISIONS)
|
||||
self.assertEqual(self.run_main("--check")[0], 1, "the plan in the config's folder is not ranked yet")
|
||||
self.assertEqual(self.run_main(), (0, ""))
|
||||
self.assertEqual(self.run_main("--check"), (0, ""))
|
||||
self.assertEqual(self.run_main("--check"), (0, f"{folder / 'todo.md'}: warning: {UNPREDICTED}\n"))
|
||||
self.assertEqual(pathlib.Path(temp, "todo.md").read_text(), "the project owners' own notes\n")
|
||||
(folder / "decisions.md").write_bytes(b"\xff")
|
||||
self.assertEqual(self.run_main(), (1, f"cannot read {folder}/decisions.md: not UTF-8 on line 1\n"))
|
||||
@@ -111,6 +114,23 @@ class Main(unittest.TestCase):
|
||||
self.assertEqual(self.run_main(str(todo)), (1, f"{todo}: {under}\n"))
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (1, f"{todo}: {under}\n"))
|
||||
|
||||
def test_check_warns_without_failing_on_the_next_releases_items_without_a_touches_list(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
self.configured(temp)
|
||||
self.enterContext(contextlib.chdir(temp))
|
||||
pathlib.Path(temp, "README.md").write_text(README)
|
||||
pathlib.Path(temp, "docs").mkdir()
|
||||
pathlib.Path(temp, "docs", "decisions.md").write_text(DECISIONS)
|
||||
# Item 3 of the next release, 0.1.0, holds a list; item 1 of 0.2.0 holds none, and is not named.
|
||||
todo.write_text(TODO.replace("Fast detail.", READABLE_TOUCHES))
|
||||
self.assertEqual(self.run_main(str(todo))[0], 0)
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (0, f"{todo}: warning: {UNPREDICTED.replace('3, ', '')}\n"))
|
||||
every = "".join(f"### {id_}. Do it.\n\n{READABLE_TOUCHES}\n" for id_ in (2, 4, 5))
|
||||
todo.write_text(todo.read_text().replace("## Notes", f"{every}## Notes"))
|
||||
self.assertEqual(self.run_main(str(todo))[0], 0)
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
|
||||
|
||||
def test_check_fails_on_each_item_whose_touches_list_it_cannot_read(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
@@ -140,7 +160,7 @@ class Main(unittest.TestCase):
|
||||
pathlib.Path(temp, "docs").mkdir()
|
||||
pathlib.Path(temp, "docs", "decisions.md").write_text(DECISIONS)
|
||||
self.assertEqual(self.run_main(str(todo)), (0, f"{todo}: {ranking.RESHAPE}\n"))
|
||||
self.assertEqual(self.run_main("--check", str(todo)), (0, ""))
|
||||
self.assertEqual(self.run_main("--check", str(todo))[0], 0)
|
||||
|
||||
def test_shows_a_valid_file_in_help_and_names_arguments_it_cannot_read(self):
|
||||
self.assertEqual(self.run_main("--help")[0], 0)
|
||||
|
||||
Reference in New Issue
Block a user