Skip to content

Commit

Permalink
test(changelog): handle custom tag_format in changelog generation
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamhar committed Mar 26, 2024
1 parent cf69409 commit c89218b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/commands/test_changelog_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,31 @@ def test_changelog_template_extras_precedance(
assert changelog.read_text() == "from-command - from-config - from-plugin"


@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.freeze_time("2021-06-11")
def test_changelog_only_tag_matching_tag_format_included(
mocker: MockFixture,
changelog_path: Path,
config_path: Path,
):
with open(config_path, "a", encoding="utf-8") as f:
f.write('\ntag_format = "${version}custom"\n')
create_file_and_commit("feat: new file")
git.tag("v0.2.0")
create_file_and_commit("feat: another new file")
git.tag("0.2.0")
git.tag("random0.2.0")
testargs = ["cz", "bump", "--changelog", "--yes"]
mocker.patch.object(sys, "argv", testargs)
cli.main()
wait_for_tag()
with open(changelog_path) as f:
out = f.read()
assert out.startswith("## 0.2.0custom (2021-06-11)")
assert "## v0.2.0 (2021-06-11)" not in out
assert "## 0.2.0 (2021-06-11)" not in out


def test_changelog_template_extra_quotes(
mocker: MockFixture,
tmp_commitizen_project: Path,
Expand Down

0 comments on commit c89218b

Please sign in to comment.