Test the finishing's singular and plural wording, its filing instructions and the fake's refusals

This commit is contained in:
2026-11-19 00:21:51 +01:00
parent 3fac9f81bb
commit 9b47b76f52
+10 -2
View File
@@ -7,8 +7,9 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from do_epic.test_main import Description, DoEpicTest, MODELS, UNREAD
from do_epic.epic_record import EpicRecord
from failure import Failure
from loop_claude.test_loop_claude import FakeEffects, judged, Worker
from do_epic import finish, main
from do_epic import findings, finish, main
from do_epic.test_scheduler import issue
from do_epic.backend.fake import MemoryEpic
from loop_state.paths import paths_from
@@ -39,7 +40,8 @@ class TheFinishingChunksTask(DoEpicTest):
def test_first_asks_for_one_review_issue_per_repo_that_lacks_one(self) -> None:
task = finish.task("ABC-12", [issue("ABC-20", "repo:api", done=True), issue("ABC-21", "repo:web", done=True)], LAUNCHER, "Swedish")
self.assertIn("Finish the epic ABC-12", task)
self.assertIn("api and web", task)
self.assertIn("first, and api and web have none. ", task)
self.assertIn("first, and api has none. ", finish.task("ABC-12", [issue("ABC-20", "repo:api", done=True)], LAUNCHER, "Swedish"))
self.assertIn('`/b/do-epic ABC-12 --file "<summary>" --label repo:<name> --label do-epic-release-review`', task)
self.assertIn("`Release review of ABC-12`", task)
self.assertIn("in Swedish", task)
@@ -52,6 +54,7 @@ class TheFinishingChunksTask(DoEpicTest):
self.assertIn("ask the human to approve the set", task)
self.assertIn("`/b/do-epic ABC-12 --close-epic`", task)
self.assertIn("in Swedish", task)
self.assertIn(findings.instructions("ABC-12", LAUNCHER, "Swedish"), task)
self.assertIn("- ABC-20 (api): Do ABC-20\n- ABC-21: Do ABC-21\n- ABC-30 (api): Do ABC-30", task)
self.assertNotIn("do-epic-release-review`", task)
@@ -85,6 +88,8 @@ class ClosingTheEpic(DoEpicTest):
self.assertEqual(code, 1)
self.assertIn("cannot close the epic ABC-12: ABC-31 is open\n", err)
self.assertEqual((self.store.comments, self.store.done), ({}, False))
self.issues.append(issue("ABC-32", "repo:api"))
self.assertIn("cannot close the epic ABC-12: ABC-31 and ABC-32 are open\n", self.close()[2])
def test_refuses_while_a_repo_the_epic_changed_lacks_its_release_review(self) -> None:
self.issues.append(issue("ABC-31", "repo:web", done=True))
@@ -92,6 +97,8 @@ class ClosingTheEpic(DoEpicTest):
self.assertEqual(code, 1)
self.assertIn("cannot close the epic ABC-12: no issue labelled do-epic-release-review reviews web\n", err)
self.assertEqual((self.store.comments, self.store.done), ({}, False))
self.issues.append(issue("ABC-32", "repo:docs", done=True))
self.assertIn("reviews docs or web\n", self.close()[2])
def test_refuses_a_blank_summary_and_says_why_the_tracker_refused(self) -> None:
code, _, err = self.close(" \n")
@@ -102,6 +109,7 @@ class ClosingTheEpic(DoEpicTest):
code, _, err = self.close()
self.assertEqual(code, 1)
self.assertIn("cannot close the epic ABC-12: Jira answered 401\n", err)
self.assertEqual((self.store.closed(), self.store.close("Shipped.")), (Failure("Jira answered 401"), Failure("Jira answered 401")))
def test_prints_the_help_for_a_closing_spelt_wrong(self) -> None:
for argv in (["ABC-12", "--close-epic", "now"], ["--close-epic", "ABC-12"], ["--close-epic"]):