Kill the mutants that survived the stability round's fixes
CI / tests (pull_request) Successful in 3m27s
CI / tests (pull_request) Successful in 3m27s
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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}}")
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user