diff --git a/tests/test_cli.py b/tests/test_cli.py index fda149c0..817d7930 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2736,7 +2736,7 @@ def advance(seconds): @pytest.mark.parametrize("after", ["pending", "late_success", "head_move", "blocker", "cancelled"]) -def test_ready_transition_preserves_deadline_and_gates(wt, gh, capsys, monkeypatch, head, after): +def test_ready_transition_preserves_deadline_and_gates(wt, gh, capsys, monkeypatch, head, after, replay_gh): arm_approved_pr_with_check_result(gh, head, wt, "pending") gh.respond("pr ready", "") clock, sleeps, transitioned = [0.0], [], [False] @@ -2817,14 +2817,13 @@ def advance(seconds): @pytest.mark.parametrize("wait,draft", [(True, True), (False, True), (True, False)]) -def test_ready_transition_immediate_green_is_best_effort(wt, gh, capsys, head, wait, draft): +def test_ready_transition_immediate_green_is_best_effort(wt, gh, capsys, head, wait, draft, replay_gh): arm_approved_ready_pr(gh, head, wt, isDraft=draft) gh.respond("pr ready", "") code, out, err = run(capsys, "ready", *(["--wait"] if wait else [])) - out = without_accepted_receipt(out) - assert (code, out, err) == (0, f"ready: {URL}\n", "") + assert (code, without_accepted_receipt(out), err) == (0, f"ready: {URL}\n", "") assert sum(c["argv"][:2] == ["pr", "ready"] for c in gh.calls) == int(draft) observations = sum(c["argv"][:2] == ["api", f"repos/{REPO}/commits/{head}/check-runs"] for c in gh.calls) @@ -2865,7 +2864,7 @@ def test_ready_wait_review_failure_freshness( wait, expected, waited, - head, + head, replay_gh, ) -> None: (wt / "workflow.toml").write_text(WORKFLOW.replace('["checks"]', json.dumps([name]))) arm_approved_pr_with_check_result( diff --git a/tests/test_review_recovery.py b/tests/test_review_recovery.py index 0518066e..47202ff5 100644 --- a/tests/test_review_recovery.py +++ b/tests/test_review_recovery.py @@ -21,6 +21,7 @@ ) gh, git_seed, repo, wt = support.gh, support.git_seed, support.repo, support.wt +replay_gh = support.replay_gh REVIEW_COMMENTS = f"api repos/{REPO}/pulls/7/reviews/17/comments?per_page=100&page=1" @@ -88,7 +89,7 @@ def assert_single_publication(gh, fake_bin): @pytest.mark.parametrize("verdict", [0, 5]) @pytest.mark.parametrize("interrupted", [False, True, "timeout"]) def test_accepted_publication_recovers_saved_verdict( - wt, gh, fake_bin, monkeypatch, capsys, kind, verdict, interrupted, + wt, gh, fake_bin, monkeypatch, capsys, kind, verdict, interrupted, replay_gh, ): lost_reply(wt, gh, fake_bin, monkeypatch, kind=kind, verdict=verdict, interrupted=interrupted is True, timeout=interrupted == "timeout") @@ -113,7 +114,7 @@ def test_accepted_publication_recovers_saved_verdict( "head", "comment_page", "kind", "wrong_head"]) @pytest.mark.parametrize("interrupted", [False, True]) def test_recovery_requires_exact_live_publication( - wt, gh, fake_bin, monkeypatch, capsys, change, interrupted, + wt, gh, fake_bin, monkeypatch, capsys, change, interrupted, replay_gh, ): def mutate(rows, comments): if change == "body": @@ -247,7 +248,7 @@ def request(argv, **kwargs): ("null", "single"), ("empty", "single"), ("malformed", "single"), ]) def test_historical_publication_recovery_is_exact_and_legacy_only( - interrupted_receipt, gh, fake_bin, capsys, metadata, source, shape, + replay_gh, interrupted_receipt, gh, fake_bin, capsys, metadata, source, shape, ): head, path, saved, _ = interrupted_receipt envelope = json.loads(saved["raw"])