Kill the mutants that survived the stability round's fixes
CI / tests (pull_request) Successful in 3m27s

This commit is contained in:
Lilleman
2026-11-20 22:00:40 +01:00
parent d464f271bf
commit e820a0c87c
3 changed files with 8 additions and 6 deletions
+1
View File
@@ -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()
+1
View File
@@ -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}}")
+6 -6
View File
@@ -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):