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_filesfetches the start of the range on its own, which leaves a second boundary in the clone.new_commitsmust 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
metadatacommand 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 difffailure 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 diffnames, as strings, match the inventory’sPathobjects.
- 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_version_at_prefers_the_bumpversion_file(repository)[source]¶
.bumpversion.tomlwins overpyproject.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_commitsreads 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.