Refuse a Touches: list touch-predictions cannot read in todo-item add and edit, and in rank_todo.py --check
This commit is contained in:
@@ -11,6 +11,7 @@ from project_config.test_project_config import configured
|
||||
from plan.test_ranking import DECISIONS, OLD_SHAPE, README, TODO
|
||||
from project_config.settings import DEFAULT_FLOOR
|
||||
from plan import goals_file, ranking
|
||||
from todo_item.test_todo_item import READABLE_TOUCHES, UNREADABLE_BULLETS
|
||||
import rank_todo
|
||||
|
||||
|
||||
@@ -102,6 +103,25 @@ 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_fails_on_each_item_whose_touches_list_it_cannot_read(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
configured(self, pathlib.Path(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)
|
||||
for bullet in UNREADABLE_BULLETS:
|
||||
with self.subTest(bullet):
|
||||
# Item 1 sits in a later release than item 3: the check reads every item's list, not only the next release's.
|
||||
todo.write_text(TODO.replace("Fast detail.", READABLE_TOUCHES).replace("Later detail.", f"Touches:\n\n{bullet}"))
|
||||
self.assertEqual(self.run_main(str(todo))[0], 0)
|
||||
code, said = self.run_main("--check", str(todo))
|
||||
self.assertEqual(code, 1)
|
||||
self.assertTrue(said.startswith(f"{todo}: item 1: "), said)
|
||||
self.assertIn(repr(bullet), said)
|
||||
self.assertEqual(said.count("\n"), 1)
|
||||
|
||||
def test_says_to_reshape_an_old_shape_table_but_passes_the_check(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
|
||||
Reference in New Issue
Block a user