tests.test_prepare_release moduleΒΆ

Tests for repomatic.release.prepare_release: the release freeze and unfreeze edits.

tests.test_prepare_release.temp_changelog(tmp_path: Path) → Path[source]ΒΆ

Create a temporary changelog file.

Return type:

Path

tests.test_prepare_release.temp_citation(tmp_path: Path) → Path[source]ΒΆ

Create a temporary citation file.

Return type:

Path

tests.test_prepare_release.temp_workflows(tmp_path: Path) → Path[source]ΒΆ

Create a temporary workflows directory with sample files.

Return type:

Path

tests.test_prepare_release.temp_workflows_with_actions(tmp_path: Path) → Path[source]ΒΆ

Create workflows referencing a discoverable composite action.

The action freeze/unfreeze logic enumerates .github/actions/*/action.y*ml to decide which action names to rewrite, so the fixture materializes a dummy pr-metadata/action.yaml alongside the workflow that references it.

Return type:

Path

tests.test_prepare_release.temp_workflows_with_cli(tmp_path: Path) → Path[source]ΒΆ

Create workflows with lockfile-backed uv run CLI invocations.

Return type:

Path

tests.test_prepare_release.temp_pyproject(tmp_path: Path) → Path[source]ΒΆ

Create a temporary pyproject.toml with bumpversion config.

Return type:

Path

tests.test_prepare_release.test_current_version_from_pyproject()[source]ΒΆ

Test that current version is read from pyproject.toml.

Return type:

None

tests.test_prepare_release.test_freeze_action_reference(temp_workflows_with_actions)[source]ΒΆ

Test that composite action references are frozen to versioned tag.

Return type:

None

tests.test_prepare_release.test_composite_action_names_enumerates_actions_dir(tmp_path)[source]ΒΆ

composite_action_names discovers every action.y(a)ml directory.

Conformance test: a freshly-created action under .github/actions/ must appear in the discovery list without code changes elsewhere.

Return type:

None

tests.test_prepare_release.test_composite_action_names_empty_when_no_actions_dir(tmp_path)[source]ΒΆ

composite_action_names returns an empty list when actions/ is absent.

Return type:

None

tests.test_prepare_release.test_freeze_unfreeze_round_trip_per_action(tmp_path)[source]ΒΆ

Every discovered action is frozen and unfrozen idempotently.

Parametrize-style conformance check: enumerate the population of discovered composite actions, run freeze then unfreeze, and assert each action’s @main ↔ @v{version} substitution round-trips.

Return type:

None

tests.test_prepare_release.test_freeze_cli_version(temp_workflows_with_cli)[source]ΒΆ

Test that the local uv run invocation is frozen to a PyPI version.

Return type:

None

tests.test_prepare_release.test_freeze_workflow_urls(temp_workflows)[source]ΒΆ

Test that workflow URLs are frozen to versioned tag.

Return type:

None

tests.test_prepare_release.test_post_release(temp_workflows)[source]ΒΆ

Test post-release workflow unfreezing.

Return type:

None

tests.test_prepare_release.test_post_release_unfreezes_cli(temp_workflows_with_cli)[source]ΒΆ

Test that post-release unfreezes CLI invocations back to local source.

Return type:

None

tests.test_prepare_release.test_prepare_release_full(temp_changelog, temp_citation, temp_workflows)[source]ΒΆ

Test full release preparation with all options.

Return type:

None

tests.test_prepare_release.test_prepare_release_freezes_cli(temp_changelog, temp_citation, temp_workflows_with_cli)[source]ΒΆ

Test that prepare_release freezes CLI invocations to current version.

Return type:

None

tests.test_prepare_release.test_prepare_release_without_workflows(temp_changelog, temp_citation)[source]ΒΆ

Test release preparation without workflow updates.

Return type:

None

tests.test_prepare_release.test_release_date_format()[source]ΒΆ

Test that release date is in correct format.

Return type:

None

tests.test_prepare_release.test_set_citation_release_date(temp_citation)[source]ΒΆ

Test that release date is set in citation file.

Return type:

None

tests.test_prepare_release.test_set_citation_release_date_missing_file(tmp_path)[source]ΒΆ

Test that missing citation file is handled gracefully.

Return type:

None

tests.test_prepare_release.test_unfreeze_action_reference(temp_workflows_with_actions)[source]ΒΆ

Test that composite action references are unfrozen to default branch.

Return type:

None

tests.test_prepare_release.test_unfreeze_cli_version(temp_workflows_with_cli)[source]ΒΆ

Test that frozen PyPI version is unfrozen back to local source.

Return type:

None

tests.test_prepare_release.test_spliced_exemption_round_trips_through_unfreeze(temp_workflows_with_cli)[source]ΒΆ

A pin exempted by sync-workflow-pins unfreezes like a frozen one.

The freeze and apply_self_pin_exemption are two writers of the same command line: they must converge on one byte sequence, or the unfreeze pattern silently skips whichever spelling it does not recognize.

Return type:

None

tests.test_prepare_release.test_unfreeze_workflow_urls(temp_workflows)[source]ΒΆ

Test that workflow URLs are unfrozen back to default branch.

Return type:

None

tests.test_prepare_release.temp_install(tmp_path: Path) → Path[source]ΒΆ

Create a temporary install guide with binary download table.

Return type:

Path

tests.test_prepare_release.temp_install_frozen(tmp_path: Path) → Path[source]ΒΆ

Create a temporary install guide with previously frozen download URLs.

Return type:

Path

tests.test_prepare_release.test_freeze_install_download_urls(temp_install)[source]ΒΆ

Test that initial /releases/latest/download/ URLs are frozen.

Return type:

None

tests.test_prepare_release.test_freeze_install_download_urls_already_frozen(temp_install_frozen)[source]ΒΆ

Test that previously frozen URLs are re-frozen to new version.

Return type:

None

Test that display text in markdown links is also updated.

Return type:

None

tests.test_prepare_release.test_freeze_install_missing_file(tmp_path)[source]ΒΆ

Test that a missing install guide is handled gracefully.

Return type:

None

tests.test_prepare_release.RATCHETING_FREEZES = frozenset({'freeze_install_cli_version', 'freeze_install_download_urls', 'freeze_marketplace_pin', 'freeze_plugin_manifest_version'})ΒΆ

Freeze passes that deliberately have no unfreeze_ counterpart.

Each one writes a value that must keep naming the last published release between cycles, so walking it back would leave main advertising a vX.Y.Z.devN tag that was never created.

tests.test_prepare_release.test_every_freeze_declares_its_direction()[source]ΒΆ

A freeze pass either round-trips or is named as ratcheting, never neither.

Which of the two a pin follows is a decision, and it was prose-only until this test: a new freeze_ method simply omitted from post_release looked exactly like one that ratchets on purpose. This guards additions from here on and claims no coverage of the ones already in place.

Return type:

None

tests.test_prepare_release.test_freeze_marketplace_pin(tmp_path)[source]ΒΆ

Both halves of an already-pinned entry ratchet to the new release.

Return type:

None

tests.test_prepare_release.test_freeze_marketplace_pin_leaves_an_unpinned_entry_alone(tmp_path)[source]ΒΆ

A never-released catalog tracks the default branch until a tag exists.

Return type:

None

tests.test_prepare_release.test_freeze_marketplace_pin_missing_file(tmp_path)[source]ΒΆ

A repository with no plugin marketplace is left alone.

Return type:

None

tests.test_prepare_release.test_freeze_plugin_manifest_version(tmp_path)[source]ΒΆ

The manifest a git-subdir source publishes names the new release.

Return type:

None

tests.test_prepare_release.test_freeze_plugin_manifest_version_missing_file(tmp_path)[source]ΒΆ

A repository shipping no plugin is left alone.

Return type:

None

tests.test_prepare_release.test_post_release_leaves_the_plugin_manifest_version(tmp_path, temp_changelog, temp_citation, temp_workflows)[source]ΒΆ

The unfreeze must not walk the manifest back to a .devN version.

This is why the version is written here rather than by bump-my-version, which runs on both release commits: the post-release bump would leave the published manifest advertising a X.Y.Z.devN release that was never tagged.

Return type:

None

tests.test_prepare_release.test_post_release_leaves_the_marketplace_pin(tmp_path, temp_changelog, temp_citation, temp_workflows)[source]ΒΆ

The unfreeze splits the entry: the ref tracks main, the version does not.

Pointing ref back at the default branch is what lets the app’s Sync automatically see a change at all, since a tag never moves. The version beside it keeps naming the last release rather than following the post-release bump, which would advertise a X.Y.Z.devN release nobody can install.

Return type:

None

tests.test_prepare_release.test_freeze_unfreeze_round_trips_the_marketplace_ref(tmp_path)[source]ΒΆ

The ref returns to the default branch it started on, and the file with it.

Return type:

None

tests.test_prepare_release.test_prepare_release_freezes_install(temp_changelog, temp_citation, temp_workflows, temp_install)[source]ΒΆ

Test that prepare_release(update_workflows=True) freezes install URLs.

Return type:

None

tests.test_prepare_release.temp_install_pinned(tmp_path: Path) → Path[source]ΒΆ

Create a temporary install guide with pinned CLI version examples.

Return type:

Path

tests.test_prepare_release.test_freeze_install_cli_version(temp_install_pinned)[source]ΒΆ

Test that pinned @ and == CLI examples are bumped to the release.

Return type:

None

tests.test_prepare_release.test_freeze_install_cli_version_leaves_other_pins(temp_install_pinned)[source]ΒΆ

Test that prefixed package names and git refs are left untouched.

Return type:

None

tests.test_prepare_release.test_freeze_install_cli_version_idempotent(temp_install_pinned)[source]ΒΆ

Test that re-freezing to the same version is a no-op.

Return type:

None

tests.test_prepare_release.test_freeze_install_cli_version_missing_file(tmp_path)[source]ΒΆ

Test that a missing install guide is handled gracefully.

Return type:

None

tests.test_prepare_release.test_prepare_release_pins_install_cli(temp_changelog, temp_citation, temp_install_pinned)[source]ΒΆ

Test that prepare_release() pins CLI examples without workflows.

Return type:

None

tests.test_prepare_release.YAMLLINT_LINE_LENGTH = 120ΒΆ

Column cap from the bundled yamllint.yaml, mirrored here.

Not imported from the YAML: this test asserts the frozen workflows satisfy the same rule the lint-yaml job applies to the working tree, and reading the config would make the test pass by construction if the cap were ever loosened to accommodate a freeze that outgrew it.

tests.test_prepare_release.test_freeze_keeps_workflows_within_line_length(tmp_path)[source]ΒΆ

Freezing the real workflows must not breach yamllint’s column cap.

The freeze swaps the local uv run invocation for the pin plus its cooldown exemption, which is markedly longer, and it is a blind string replacement: a line that fits on main can overflow only once frozen. Nothing else catches that, because the frozen state is never committed to main and only exists on the release commit, where the failure would surface as a red lint-yaml on every release.

Return type:

None

tests.test_prepare_release.test_freeze_exempts_self_pin_from_cooldown(tmp_path)[source]ΒΆ

Every frozen invocation carries the cooldown escape hatch.

Without it the workflow-wide UV_EXCLUDE_NEWER would refuse the pin the freeze just wrote, since it names a release published minutes earlier.

Return type:

None

tests.test_prepare_release.test_freeze_unfreeze_round_trips(tmp_path)[source]ΒΆ

Unfreezing restores the source byte for byte, exemption included.

Return type:

None