tests.test_pr moduleΒΆ
Tests for repomatic.github.pr.
- tests.test_pr.BRANCH = 'sync-fruit-basket'ΒΆ
Arbitrary head branch the sync tests target.
- tests.test_pr.BASE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'ΒΆ
Stand-in SHA for the base branch tip.
- tests.test_pr.CANDIDATE_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'ΒΆ
Stand-in SHA for the commit built from the working tree.
- tests.test_pr.REMOTE_SHA = 'cccccccccccccccccccccccccccccccccccccccc'ΒΆ
Stand-in SHA for the tip of an already-published head branch.
- tests.test_pr.OTHER_SHA = 'dddddddddddddddddddddddddddddddddddddddd'ΒΆ
Stand-in SHA for a tip a concurrent run published after this one read it.
- tests.test_pr.test_list_changed_files_reads_every_page()[source]ΒΆ
The files of every page come back as paths, in API order.
- tests.test_pr.test_close_pr_unlocks_a_locked_conversation()[source]ΒΆ
A hand-locked PR is unlocked so the retire pathβs close comment lands.
- tests.test_pr.test_close_stale_bump_prs_retires_the_bump_branch(part)[source]ΒΆ
The pull request of a bump no longer allowed closes, saying why.
- tests.test_pr.test_needs_push(candidate_tree, remote_tree, remote_commits, expected_commits, expected)[source]ΒΆ
- tests.test_pr.git(monkeypatch)[source]ΒΆ
A stand-in for the git layer, wired to the ordinary happy path.
Each test overrides only the calls its own scenario turns on, which keeps the interesting difference visible instead of buried in a stack of patches.
- tests.test_pr.gh(monkeypatch)[source]ΒΆ
Capture
ghinvocations, returning whatever the test queues up.One stub covers every dispatch point: the moduleβs own calls, the listings parsed through the
ghmodule, and the close path and label writes of the threads module. A single mock keeps each testβs call sequence in one list.
- tests.test_pr.verbs(gh_stub)[source]ΒΆ
The
gh <noun> <verb>pairs a testβs run produced, in order.
- tests.test_pr.test_upsert_pr_falls_back_to_the_event_default_branch(git, gh, monkeypatch, tmp_path)[source]ΒΆ
A detached checkout takes its base from the CI event payload.
- tests.test_pr.test_upsert_pr_without_changes_or_branch_does_nothing(git, gh)[source]ΒΆ
The quietest path: nothing to publish and nothing to retire.
- tests.test_pr.test_upsert_pr_retires_branch_and_pr_when_changes_evaporate(git, gh)[source]ΒΆ
The path a skipped action step could never reach.
- tests.test_pr.test_upsert_pr_skips_the_push_when_the_branch_already_matches(git, gh)[source]ΒΆ
The check that keeps an unchanged job from re-triggering every workflow.
- tests.test_pr.test_upsert_pr_keeps_a_concurrent_push_on_its_base(git, gh)[source]ΒΆ
A run losing its lease to one built on the same base keeps that push.
- tests.test_pr.test_upsert_pr_pushes_again_over_a_concurrent_push_on_an_older_base(git, gh)[source]ΒΆ
A run losing its lease to one built on an older base pushes once more.
- tests.test_pr.test_upsert_pr_survives_a_refused_label_or_assignee(git, gh)[source]ΒΆ
github-actions[bot]cannot be assigned, and that must not lose the PR.
- tests.test_pr.test_upsert_pr_opens_against_an_explicit_base_from_a_detached_head(git, gh)[source]ΒΆ
fix-changelogandbump-versioncheck out a raw SHA, not a branch.
- tests.test_pr.test_upsert_pr_carries_commits_the_job_made_itself(git, gh)[source]ΒΆ
prepare-releasecommits freeze and unfreeze; both must reach the PR.
- tests.test_pr.test_upsert_pr_publishes_anyway_when_the_replay_conflicts(git, gh)[source]ΒΆ
A branch on a stale base still opens a usable PR; the next run converges.
- tests.test_pr.test_upsert_pr_skips_the_replay_when_history_is_unrelatable(git, gh)[source]ΒΆ
A shallow clone answers neither yes nor no, and must not be rebased blind.
- tests.test_pr.test_upsert_pr_puts_a_readied_pr_back_into_draft(git, gh)[source]ΒΆ
draftis re-applied on update, matching the actionβs always-true mode.
- tests.test_pr.cli_upsert(monkeypatch)[source]ΒΆ
Capture what the
pr-synccommand hands toupsert_pr.
- tests.test_pr.test_pr_sync_cli_resolves_everything_from_the_template(cli_upsert)[source]ΒΆ
One flag yields branch, labels, draft, title, body and commit message.
- tests.test_pr.test_pr_sync_cli_renders_the_upgrade_template(tmp_path, monkeypatch)[source]ΒΆ
The
init --upgradestep outputs reach the pull request title and body.
- tests.test_pr.test_pr_sync_cli_draft_flag_overrides_frontmatter(cli_upsert)[source]ΒΆ
--draftholds a pull request in draft that its template opens ready.
- tests.test_pr.test_pr_sync_cli_explicit_trio_names_the_pull_request(monkeypatch)[source]ΒΆ
Without a template, the trio and
--branchreach the sync as given.
- tests.test_pr.test_pr_sync_cli_names_the_missing_template_argument(monkeypatch)[source]ΒΆ
A template argument nothing supplies is a usage error, and nothing syncs.
- tests.test_pr.test_carry_pr_branch_paths_outcomes(monkeypatch, tip, restored, expected)[source]ΒΆ
Work travels only when the branch exists and carries the named file.
Every other outcome is the first run of a fresh accrual, which must be a silent no-op rather than a failure: the branch is legitimately gone after each merge.
- tests.test_pr.test_carry_pr_branch_paths_restores_the_fetched_tip(monkeypatch)[source]ΒΆ
The restore reads the tip just fetched, never the branch name.
A branch name resolves against whatever remote-tracking ref the checkout held before the fetch, which on a CI clone is frequently nothing at all.
- tests.test_pr.test_automation_branches_are_the_pull_request_templates_and_bump_branches()[source]ΒΆ
Every template fronting a pull request names a branch; the others do not.
- tests.test_pr.test_behind_by_reads_the_comparison()[source]ΒΆ
The count comes off the compare endpoint,
Nonewhen it cannot be read.