Rank, check and edit the plan at the paths the project's config names
This commit is contained in:
@@ -23,6 +23,7 @@ class Main(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
configured(self, pathlib.Path(temp))
|
||||
self.enterContext(contextlib.chdir(temp))
|
||||
todo.write_text(TODO)
|
||||
pathlib.Path(temp, "README.md").write_text(README)
|
||||
pathlib.Path(temp, "docs").mkdir()
|
||||
@@ -38,11 +39,30 @@ class Main(unittest.TestCase):
|
||||
todo.unlink()
|
||||
self.assertEqual(self.run_main(str(todo)), (1, f"{todo}: not found; every project keeps a todo.md, and rank_todo.py --help shows one\n"))
|
||||
|
||||
def test_ranks_the_plan_and_reads_the_decisions_where_the_config_puts_them(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
folder = configured(self, pathlib.Path(temp))
|
||||
self.enterContext(contextlib.chdir(temp))
|
||||
config = folder / "config.toml"
|
||||
config.write_text(config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"').replace('"checkout:docs/decisions.md"', '"folder:decisions.md"'))
|
||||
pathlib.Path(temp, "README.md").write_text(README)
|
||||
pathlib.Path(temp, "todo.md").write_text("the project owners' own notes\n")
|
||||
(folder / "todo.md").write_text(TODO)
|
||||
self.assertIn("docs/decisions.md does not cite", self.run_main()[1])
|
||||
(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(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"{folder}/decisions.md: not UTF-8\n"))
|
||||
|
||||
def test_writes_the_ranked_file_yet_fails_on_an_item_under_the_bar(self):
|
||||
under = "item 2 scores 3.1, under the bar 4; delete it, or mark it with a reason the bar does not apply"
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
configured(self, pathlib.Path(temp))
|
||||
self.enterContext(contextlib.chdir(temp))
|
||||
todo.write_text(TODO.replace("`Bar = 2`", "`Bar = 4`"))
|
||||
pathlib.Path(temp, "README.md").write_text(README)
|
||||
pathlib.Path(temp, "docs").mkdir()
|
||||
@@ -54,6 +74,7 @@ class Main(unittest.TestCase):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
todo = pathlib.Path(temp, "todo.md")
|
||||
configured(self, pathlib.Path(temp))
|
||||
self.enterContext(contextlib.chdir(temp))
|
||||
todo.write_text(OLD_SHAPE)
|
||||
pathlib.Path(temp, "README.md").write_text(README)
|
||||
pathlib.Path(temp, "docs").mkdir()
|
||||
|
||||
Reference in New Issue
Block a user