Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a7cea66

Browse files
test(changelog): handle custom tag_format in changelog generation
1 parent 038d01b commit a7cea66

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎tests/commands/test_changelog_command.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,31 @@ def test_changelog_template_extras_precedance(
14911491
assert changelog.read_text() == "from-command - from-config - from-plugin"
14921492

14931493

1494+
@pytest.mark.usefixtures("tmp_commitizen_project")
1495+
@pytest.mark.freeze_time("2021年06月11日")
1496+
def test_changelog_only_tag_matching_tag_format_included(
1497+
mocker: MockFixture,
1498+
changelog_path: Path,
1499+
config_path: Path,
1500+
):
1501+
with open(config_path, "a", encoding="utf-8") as f:
1502+
f.write('\ntag_format = "${version}custom"\n')
1503+
create_file_and_commit("feat: new file")
1504+
git.tag("v0.2.0")
1505+
create_file_and_commit("feat: another new file")
1506+
git.tag("0.2.0")
1507+
git.tag("random0.2.0")
1508+
testargs = ["cz", "bump", "--changelog", "--yes"]
1509+
mocker.patch.object(sys, "argv", testargs)
1510+
cli.main()
1511+
wait_for_tag()
1512+
with open(changelog_path) as f:
1513+
out = f.read()
1514+
assert out.startswith("## 0.2.0custom (2021年06月11日)")
1515+
assert "## v0.2.0 (2021年06月11日)" not in out
1516+
assert "## 0.2.0 (2021年06月11日)" not in out
1517+
1518+
14941519
def test_changelog_template_extra_quotes(
14951520
mocker: MockFixture,
14961521
tmp_commitizen_project: Path,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /