Read a project's goals and audience from the file its config names, in place of README.md
CI / tests (pull_request) Successful in 2m17s

This commit is contained in:
2026-11-13 00:06:11 +01:00
parent b439cd82e1
commit eb61043c12
37 changed files with 243 additions and 147 deletions
+5 -1
View File
@@ -7,6 +7,7 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from project_config.test_project_config import configured
from release_plan.test_ranking import DECISIONS, OLD_SHAPE, README, TODO
import rank_todo
from release_plan import ranking
@@ -21,6 +22,7 @@ class Main(unittest.TestCase):
def test_ranks_the_file_in_place_and_check_writes_nothing(self):
with tempfile.TemporaryDirectory() as temp:
todo = pathlib.Path(temp, "todo.md")
configured(self, pathlib.Path(temp))
todo.write_text(TODO)
pathlib.Path(temp, "README.md").write_text(README)
pathlib.Path(temp, "docs").mkdir()
@@ -32,12 +34,13 @@ class Main(unittest.TestCase):
pathlib.Path(temp, "README.md").write_bytes(b"\xff")
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not UTF-8\n"))
pathlib.Path(temp, "README.md").unlink()
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not found; rank_todo.py weighs goals from the README.md beside todo.md\n"))
self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not found; rank_todo.py weighs goals from the file the project's config names as goals-and-audience\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))
todo.write_text(TODO.replace("`Bar = 2`", "`Bar = 4`"))
pathlib.Path(temp, "README.md").write_text(README)
pathlib.Path(temp, "docs").mkdir()
@@ -48,6 +51,7 @@ class Main(unittest.TestCase):
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")
configured(self, pathlib.Path(temp))
todo.write_text(OLD_SHAPE)
pathlib.Path(temp, "README.md").write_text(README)
pathlib.Path(temp, "docs").mkdir()