From 41b592136589aa5d87a07d0e3d9eb3cc4af81548 Mon Sep 17 00:00:00 2001 From: allen0099 Date: Fri, 25 Sep 2026 16:24:14 +0000 Subject: [PATCH] test: keep the real-changelog release check passing right after a release test_the_repository_changelog_can_be_released promotes the real CHANGELOG.md. Right after a release its `## [Unreleased]` section is empty, and promote() rightly refuses an empty section, so the test failed on master from the 0.3.7 release until the next changelog entry. That turned the Coverage Badge and Test runs red on master and on pull requests without a changelog entry (#151). When the section is empty, the test now gives it a placeholder entry before promoting, so the rest of the file (heading order and the compare links) is still checked. A non-empty section is left as it is. --- tests/test_changelog_release.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_changelog_release.py b/tests/test_changelog_release.py index 1960c6a..e0ec75c 100644 --- a/tests/test_changelog_release.py +++ b/tests/test_changelog_release.py @@ -174,6 +174,16 @@ def test_the_repository_changelog_can_be_released(): latest = re.search(r"^## \[(\d+\.\d+\.\d+)\]", text, re.MULTILINE) assert latest is not None + # Right after a release `## [Unreleased]` is empty, which promote() + # rightly refuses. Give it an entry so the rest of the file is still checked. + text = re.sub( + r"^## \[Unreleased\]\n\s*(?=^## \[)", + "## [Unreleased]\n\n### Fixed\n\n- Placeholder entry.\n\n", + text, + count=1, + flags=re.MULTILINE, + ) + rewritten, body = promote(text, "0.9.9", "2026-09-14") assert rewritten.startswith("# Changelog\n")