@@ -1540,9 +1540,47 @@ def test_changelog_only_tag_matching_tag_format_included(
15401540 mocker .patch .object (sys , "argv" , testargs )
15411541 cli .main ()
15421542 wait_for_tag ()
1543+ create_file_and_commit ("feat: some awesome new feature" )
1544+ # git.tag("0.2.1")
1545+ testargs = ["cz" , "bump" , "--changelog" , "--yes" ]
1546+ mocker .patch .object (sys , "argv" , testargs )
1547+ cli .main ()
1548+ wait_for_tag ()
1549+ with open (changelog_path ) as f :
1550+ out = f .read ()
1551+ assert out .startswith ("## 0.3.0custom (2021-06-11)" )
1552+ assert "## 0.2.0custom (2021-06-11)" in out
1553+ assert "## v0.2.0 (2021-06-11)" not in out
1554+ assert "## 0.2.0 (2021-06-11)" not in out
1555+
1556+
1557+ @pytest .mark .usefixtures ("tmp_commitizen_project" )
1558+ @pytest .mark .freeze_time ("2021-06-11" )
1559+ def test_changelog_only_tag_matching_tag_format_included_prefix (
1560+ mocker : MockFixture ,
1561+ changelog_path : Path ,
1562+ config_path : Path ,
1563+ ):
1564+ with open (config_path , "a" , encoding = "utf-8" ) as f :
1565+ f .write ('\n tag_format = "example-${version}"\n ' )
1566+ create_file_and_commit ("feat: new file" )
1567+ git .tag ("v0.2.0" )
1568+ create_file_and_commit ("feat: another new file" )
1569+ git .tag ("0.2.0" )
1570+ git .tag ("random0.2.0" )
1571+ testargs = ["cz" , "bump" , "--changelog" , "--yes" ]
1572+ mocker .patch .object (sys , "argv" , testargs )
1573+ cli .main ()
1574+ wait_for_tag ()
1575+ create_file_and_commit ("feat: some awesome new feature" )
1576+ testargs = ["cz" , "bump" , "--changelog" , "--yes" ]
1577+ mocker .patch .object (sys , "argv" , testargs )
1578+ cli .main ()
1579+ wait_for_tag ()
15431580 with open (changelog_path ) as f :
15441581 out = f .read ()
1545- assert out .startswith ("## 0.2.0custom (2021-06-11)" )
1582+ assert out .startswith ("## example-0.3.0 (2021-06-11)" )
1583+ assert "## example-0.2.0 (2021-06-11)" in out
15461584 assert "## v0.2.0 (2021-06-11)" not in out
15471585 assert "## 0.2.0 (2021-06-11)" not in out
15481586
0 commit comments