From e820a0c87c9b088a5bd1c9227d32d0fe03c657f9 Mon Sep 17 00:00:00 2001 From: Lilleman Date: Fri, 20 Nov 2026 22:00:40 +0100 Subject: [PATCH] Kill the mutants that survived the stability round's fixes --- bin/chunk_pr/test_chunk_pr.py | 1 + bin/forge/test_forge.py | 1 + bin/git_cli/test_epic_branch.py | 12 ++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/chunk_pr/test_chunk_pr.py b/bin/chunk_pr/test_chunk_pr.py index d7d9f6ea..46727ddc 100644 --- a/bin/chunk_pr/test_chunk_pr.py +++ b/bin/chunk_pr/test_chunk_pr.py @@ -1246,6 +1246,7 @@ class EpicBranch(unittest.TestCase): checkout.answers[self.ON_ORIGIN] = Failure("git ls-remote: offline") self.assertEqual(step(["open-epic", "ABC-1", "Ship the epic"], checkout, checkout.config), Failure("git ls-remote: offline")) self.assertFalse(any(command[:2] in (["git", "push"], ["gh", "pr"]) for command in checkout.ran)) + self.assertEqual([command[1] for command in checkout.ran if command[1] in ("fetch", "ls-remote")], ["ls-remote"]) def test_open_epic_opens_no_second_pull_request(self): checkout = self.epic() diff --git a/bin/forge/test_forge.py b/bin/forge/test_forge.py index ead6905c..e59fffc0 100644 --- a/bin/forge/test_forge.py +++ b/bin/forge/test_forge.py @@ -109,6 +109,7 @@ class OtherBase(unittest.TestCase): self.assertEqual(other_base("gh", "7", "main", lambda command: LONG).reason, f"gh pr view printed no base branch: {LONG[:200]}") self.assertEqual(other_base("gh", "7", "main", lambda command: "not json").reason, "gh pr view printed no base branch: not json") self.assertEqual(other_base("gh", "7", "main", lambda command: '{"baseRefName": ""}').reason, 'gh pr view printed no base branch: {"baseRefName": ""}') + self.assertEqual(other_base("tea", "7", "main", lambda command: '{"base": {"ref": 7}}').reason, "tea api answered pull request 7 in a shape that can't be read: {'base': {'ref': 7}}") self.assertEqual(other_base("tea", "7", "main", lambda command: LONG).reason, f"tea api answered pull request 7 in a shape that can't be read: {LONG[:200]}") self.assertEqual(other_base("tea", "7", "main", lambda command: '{"number": 7, "base": {}}').reason, "tea api answered pull request 7 in a shape that can't be read: {'number': 7, 'base': {}}") self.assertEqual(other_base("tea", "7", "main", lambda command: '{"number": 7, "base": {"ref": null}}').reason, "tea api answered pull request 7 in a shape that can't be read: {'number': 7, 'base': {'ref': None}}") diff --git a/bin/git_cli/test_epic_branch.py b/bin/git_cli/test_epic_branch.py index ab2ffa8f..a3951638 100644 --- a/bin/git_cli/test_epic_branch.py +++ b/bin/git_cli/test_epic_branch.py @@ -163,17 +163,17 @@ class Levelled(unittest.TestCase): self.assertEqual(levelled("ABC-1", "origin/main", run=scripted(calls, fetch=LOCKED)), LOCKED) self.assertEqual([args[0] for args in calls], ["fetch", "fetch"]) - def test_every_call_to_origin_stops_after_the_timeout_given(self) -> None: - for answers, origin_calls in (({"ls_remote": ""}, ["fetch", "ls-remote", "push", "fetch"]), ({"push": Failure("git push: rejected")}, ["fetch", "ls-remote", "push", "fetch", "ls-remote", "push"])): + def test_every_call_to_origin_runs_in_the_checkout_and_stops_after_the_timeout_given(self) -> None: + for answers, origin_calls in (({"ls_remote": ""}, ["fetch", "ls-remote", "push", "fetch"]), ({"push": Failure("git push: rejected")}, ["fetch", "ls-remote", "push", "fetch", "ls-remote", "push"]), ({"fetch": [LOCKED, ""], "ls_remote": ""}, ["fetch", "fetch", "ls-remote", "push", "fetch"]), ({"fetch": ["", LOCKED, ""], "ls_remote": ""}, ["fetch", "ls-remote", "push", "fetch", "fetch"])): with self.subTest(origin_calls=origin_calls): - timed: list[tuple[str, float | None]] = [] + timed: list[tuple[str, float | None, str | None]] = [] answering = scripted([], **answers) def run(*args: str, cwd: str | None = None, timeout: float | None = None, guarded: bool = False, errors: str = "strict") -> str | Failure: - timed.append((args[0], timeout)) + timed.append((args[0], timeout, cwd)) return answering(*args, cwd=cwd, timeout=timeout, guarded=guarded, errors=errors) - levelled("ABC-1", "origin/main", timeout=5, run=run) - self.assertEqual([(name, timeout) for name, timeout in timed if name in ("fetch", "ls-remote", "push")], [(name, 5) for name in origin_calls]) + levelled("ABC-1", "origin/main", cwd="/checkout", timeout=5, run=run) + self.assertEqual([call for call in timed if call[0] in ("fetch", "ls-remote", "push")], [(name, 5, "/checkout") for name in origin_calls]) class ChunkBase(unittest.TestCase):