tests.test_release_sync module¶

Tests for repomatic.github.release_sync: changelog-to-release-notes sync.

tests.test_release_sync.test_build_expected_body()[source]¶

Verbatim extraction from changelog.

tests.test_release_sync.test_build_expected_body_with_admonition()[source]¶

Extraction preserves admonitions when they appear in the changes group.

tests.test_release_sync.test_build_expected_body_admonition_override()[source]¶

Override replaces the changelog’s availability admonition.

tests.test_release_sync.test_build_expected_body_admonition_override_no_original()[source]¶

Override injects an admonition where none existed in the changelog.

tests.test_release_sync.test_build_expected_body_editorial_only()[source]¶

Version with only editorial admonition returns non-empty body.

tests.test_release_sync.test_build_expected_body_missing_version()[source]¶

Returns empty string for a missing version.

tests.test_release_sync.test_build_expected_body_includes_all_elements()[source]¶

The github-releases template includes all elements like release-notes.

tests.test_release_sync.test_build_expected_body_decomposes_elements()[source]¶

Verifies the decompose → template path produces correct output.

The github-releases template appends a full changelog link.

tests.test_release_sync.test_normalize_body(text, expected)[source]¶

Whitespace normalization edge cases.

tests.test_release_sync.changelog_path(tmp_path)[source]¶

A changelog file on disk holding SAMPLE_CHANGELOG.

tests.test_release_sync.expected_body(version)[source]¶

The release body sync_github_releases would render for version.

Return type:

str

tests.test_release_sync.run_sync(changelog_path, releases, *, dry_run=True, edit_result=None)[source]¶

Drive sync_github_releases against canned GitHub state.

Parameters:
  • changelog_path – The changelog the expected bodies are derived from.

  • releases – Version to GitHubRelease, as the API would return them.

  • dry_run – Passed straight through to the command.

  • edit_result – When set, edit_release_notes is patched to return it and the mock is handed back beside the result so a caller can assert on the calls. Left None, no mutation seam is installed.

Returns:

The sync result, or (result, edit_mock) when edit_result is set.

tests.test_release_sync.test_sync_all_in_sync(changelog_path)[source]¶

No updates when all bodies match.

tests.test_release_sync.test_sync_detects_drift(changelog_path)[source]¶

Flags releases with different bodies in dry-run.

tests.test_release_sync.test_sync_dry_run_no_mutations(changelog_path)[source]¶

Dry-run doesn’t call gh release edit.

tests.test_release_sync.test_sync_live_updates(changelog_path)[source]¶

Live mode calls gh release edit with correct args.

tests.test_release_sync.test_sync_missing_changelog_section(changelog_path)[source]¶

A GitHub release with no changelog section is never iterated.

tests.test_release_sync.test_sync_live_failure(changelog_path)[source]¶

Records failure when gh release edit fails.

tests.test_release_sync.test_render_sync_report_dry_run()[source]¶

Report format for dry-run mode.

tests.test_release_sync.test_render_sync_report_live()[source]¶

Report format for live mode.