From e4ac0dead07e7835a2a00ba798e6ce8023ae84f6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 16:09:55 +0100 Subject: [PATCH] Test that a refusal names the plan's file and the bad --release --- bin/plan_store/test_stores.py | 5 +++++ bin/todo_item/test_todo_item.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/plan_store/test_stores.py b/bin/plan_store/test_stores.py index 0cb5c088..0b57ba86 100644 --- a/bin/plan_store/test_stores.py +++ b/bin/plan_store/test_stores.py @@ -83,6 +83,11 @@ class FilePlan(FilePlanContract): assert isinstance(written, stores.Written), written self.assertIn("item 10 ", written.notes[0]) + def test_an_id_it_holds_no_item_for_fails_naming_the_file(self): + store = self.new_store() + missing = Failure(f"{self.folder / 'todo.md'} holds no item 99") + self.assertEqual((store.edit(99, {"L": "1"}, None), store.finish(99)), (missing, missing)) + def test_a_missing_file_fails_naming_it(self): store = self.new_store() (self.folder / "todo.md").unlink() diff --git a/bin/todo_item/test_todo_item.py b/bin/todo_item/test_todo_item.py index bdbefe95..e58ea34b 100644 --- a/bin/todo_item/test_todo_item.py +++ b/bin/todo_item/test_todo_item.py @@ -364,7 +364,11 @@ class List(TodoItem): self.assertEqual(self.run_main("list"), (0, f"{self.todo} holds no item.\n", "")) def test_fails_on_a_release_that_is_no_version(self): - self.assertEqual(self.exit_code("list", "--release", "next"), 2) + errors = io.StringIO() + with contextlib.redirect_stderr(errors), self.assertRaises(SystemExit) as raised: + main.main(["list", "--release", "next"], self.folder, io.StringIO()) + self.assertEqual(raised.exception.code, 2) + self.assertIn("argument --release: 'next' is not a semver version", errors.getvalue()) def test_changes_no_file(self): before = self.todo.read_text()