tests.test_metadata_git module¶

Tests for repomatic.metadata.git: commit ranges and changed files.

tests.test_metadata_git.repository(tmp_path, monkeypatch, hermetic_git)[source]¶

A fresh repository, the current directory.

tests.test_metadata_git.shallow_push(tmp_path, monkeypatch, hermetic_git)[source]¶

A push of the last three commits of a remote, received as a depth-1 clone.

Returns:

The SHAs of the remote’s commits, oldest first.

tests.test_metadata_git.test_push_range_resolves_in_a_shallow_clone(shallow_push, changed_files_first)[source]¶

Both properties resolve, whichever reads the range first.

changed_files fetches the start of the range on its own, which leaves a second boundary in the clone. new_commits must still walk the whole range from there, or a release push loses its release commit.

tests.test_metadata_git.test_push_creating_a_branch_has_no_range_start(shallow_push, tmp_path, monkeypatch)[source]¶

The null SHA starts no range: the changed files are unknown.

tests.test_metadata_git.test_new_commits_degrades_when_git_fails(monkeypatch, caplog)[source]¶

A git failure degrades new_commits to None and surfaces git’s stderr.

The whole metadata command keeps running instead of crashing.

Reproduces the compiled-binary self-test running inside a manylinux container over a checkout git refuses as “dubious ownership”.

tests.test_metadata_git.test_changed_files_surfaces_git_stderr(monkeypatch, caplog)[source]¶

A git diff failure degrades changed_files to None and logs git’s stderr.

tests.test_metadata_git.test_changed_file_kinds(changed, zsh_changed, workflows_changed)[source]¶

git diff names, as strings, match the inventory’s Path objects.

tests.test_metadata_git.test_skip_binary_build_release_workflow_push(workflow_file)[source]¶

A push that only touches a release-pipeline workflow must rebuild binaries.

Those workflows define how binaries are compiled and self-tested, so any change there needs a full matrix revalidation.

tests.test_metadata_git.SRC_LAYOUT_PYPROJECT = '[project]\nname = "papaya"\nversion = "1.0.0"\n\n[project.scripts]\npapaya = "papaya.__main__:main"\n\n[tool.repomatic]\nworkflow.source-paths = ["src"]\n'¶

A project keeping its package under src/, which its entry point does not name.

tests.test_metadata_git.test_binary_affecting_paths_include_source_paths(tmp_path, monkeypatch)[source]¶

A source-only push to a src/ layout still builds its binaries.

tests.test_metadata_git.test_commit_matrix_reads_each_version_from_its_commit(repository)[source]¶

Every commit carries its own version, and the checkout never moves.

Runs outside CI on purpose: reading from the object store leaves nothing to restore, so nothing needs guarding.

tests.test_metadata_git.test_commit_matrix_of_nothing_is_none()[source]¶
tests.test_metadata_git.test_version_at_prefers_the_bumpversion_file(repository)[source]¶

.bumpversion.toml wins over pyproject.toml, as bump-my-version reads it.

tests.test_metadata_git.test_version_at_without_any_source(repository)[source]¶

A commit carrying no bump-my-version configuration declares no version.

tests.test_metadata_git.test_release_commit_is_the_newest_of_a_release_push(repository, tmp_path, monkeypatch)[source]¶

A job checks out the newest release commit of the push.

list_commits reads the range oldest first, so the newest release commit is the last of the list. Reading its first entry would build and lint the older release.

tests.test_metadata_git.test_release_commit_falls_back_to_the_event_commit(monkeypatch)[source]¶

A push carrying no release commit names its own commit.

tests.test_metadata_git.test_is_release_push(monkeypatch, ref, release, expected)[source]¶

Only release commits landing on the release branch make a release push.