tests.test_git_ops moduleΒΆ
Tests for Git operations module.
- tests.test_git_ops.test_tag_command_argv(call, expected_argv)[source]ΒΆ
Each tag helper shells out to exactly the git command it names.
- tests.test_git_ops.test_tag_exists_false()[source]ΒΆ
A non-zero exit from
git show-refreads as a missing tag.
- tests.test_git_ops.test_tag_command_propagates_git_failure(call)[source]ΒΆ
A failed git invocation surfaces rather than being swallowed.
- tests.test_git_ops.git_workdir(tmp_path, monkeypatch, hermetic_git)[source]ΒΆ
A working clone (cwd) of a bare
originremote, one commit on main.
- tests.test_git_ops.test_commit_and_push_files_no_changes(git_workdir)[source]ΒΆ
Unchanged files produce no commit and report False.
- tests.test_git_ops.test_commit_and_push_files_pushes(git_workdir, tmp_path)[source]ΒΆ
A changed file is committed with the bot identity and pushed.
- tests.test_git_ops.test_commit_and_push_files_rebases_on_rejection(git_workdir, tmp_path)[source]ΒΆ
A concurrent push to another file is absorbed by fetch and rebase.
- tests.test_git_ops.test_commit_and_push_files_conflict_raises(git_workdir, tmp_path)[source]ΒΆ
A concurrent push touching the same lines aborts with a clear error.
- tests.test_git_ops.test_create_and_push_tag_at_commit()[source]ΒΆ
Create and push tag at specific commit.
- tests.test_git_ops.test_skip_existing_tag()[source]ΒΆ
Skip when tag exists and skip_existing is True.
- tests.test_git_ops.test_error_existing_tag()[source]ΒΆ
Raise ValueError when tag exists and skip_existing is False.
- tests.test_git_ops.test_get_latest_tag_version()[source]ΒΆ
Test that we can retrieve the latest Git tag version.
- tests.test_git_ops.test_get_release_version_from_commits()[source]ΒΆ
Test that get_release_version_from_commits returns expected type.
This function searches recent commits for release messages matching
[changelog] Release vX.Y.Zpattern and extracts the version.
- tests.test_git_ops.test_get_release_version_from_commits_max_count()[source]ΒΆ
Test that max_count parameter limits commit search.
- tests.test_git_ops.test_is_version_bump_allowed_returns_bool()[source]ΒΆ
Test that is_version_bump_allowed returns a boolean.
- tests.test_git_ops.test_is_version_bump_allowed_invalid_part()[source]ΒΆ
Test that is_version_bump_allowed raises for invalid parts.
- tests.test_git_ops.test_is_version_bump_allowed_current_repo()[source]ΒΆ
Test the version bump check logic against the current repository state.
This test verifies the correct behavior based on comparing current version in pyproject.toml against the latest Git tag.
- tests.test_git_ops.test_is_version_bump_allowed_uses_commit_fallback(monkeypatch, current, released, part, allowed)[source]ΒΆ
With no tag reachable, the verdict comes from the release commit.
The release workflow pushes its tag after the bump job starts, so a shallow clone or a plain race leaves
get_latest_tag_versionempty. Parsing the release commit is what keeps the guard working through that window; without the fallback the check fails open and allows a double increment.
- tests.test_git_ops.test_is_version_bump_allowed_without_tags_or_commits(monkeypatch)[source]ΒΆ
Nothing to compare against fails open, so a release is never blocked.
- tests.test_git_ops.test_branch_cycle_publishes_and_restores(git_workdir)[source]ΒΆ
A publish leaves the remote updated and the checkout exactly as found.
- tests.test_git_ops.test_stage_all_pathspec_leaves_everything_else_dirty(git_workdir)[source]ΒΆ
A scoped stage commits its pathspec and nothing else.
The case that needs it: a job installing its own tooling into the checkout, where the whole-tree default would publish the installation alongside the output. Anything outside the pathspec stays in the working tree, so it goes away with the throwaway branch instead of into the pull request.
- tests.test_git_ops.test_stage_all_pathspec_matching_nothing_reports_no_work(git_workdir)[source]ΒΆ
A pathspec no dirty file matches is not a commit waiting to happen.
- tests.test_git_ops.test_stage_all_stale_pathspec_does_not_cost_the_others(git_workdir)[source]ΒΆ
One unresolvable entry no longer takes the whole staging down with it.
git addrefuses the entire invocation on its first unmatched pathspec, so an allowlist naming output a run happened not to produce would stage nothing rather than stage the rest.
- tests.test_git_ops.test_rebuilding_the_same_output_yields_the_same_tree(git_workdir)[source]ΒΆ
The comparison that keeps an unchanged job from re-pushing.
- tests.test_git_ops.test_force_push_refuses_an_outdated_lease(git_workdir)[source]ΒΆ
A branch that moved since the caller looked is not silently overwritten.
- tests.test_git_ops.test_force_push_rejection_logs_stderr(git_workdir, caplog)[source]ΒΆ
A rejected push logs gitβs stderr, which
CalledProcessErroritself drops.
- tests.test_git_ops.test_branch_deletion_is_idempotent(git_workdir)[source]ΒΆ
Both deletions tolerate a branch that is already gone.
- tests.test_git_ops.test_rebase_onto_replays_carried_commits(git_workdir, tmp_path)[source]ΒΆ
The moved-base path: two job commits land on the newer base intact.
- tests.test_git_ops.test_rebase_onto_reports_a_conflict_without_leaving_one_behind(git_workdir)[source]ΒΆ
A conflicting replay aborts cleanly, leaving the branch usable as-is.
- tests.test_git_ops.test_restore_paths_carries_a_file_without_moving_head(git_workdir)[source]ΒΆ
A path travels from a branch while the checkout keeps its own tree.
The property the sampling lane depends on: a job reads its accumulating store back from an open pull request and still runs the code of the branch it was called on.