From d20580dda697c83bd7427704490c958cd73cd565 Mon Sep 17 00:00:00 2001 From: Lyonel Martinez Date: Fri, 29 Nov 2024 16:27:21 +0100 Subject: [PATCH] fix(get-next-bump): add a test case --- tests/commands/test_bump_command.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py index 81273764d..8acb5143c 100644 --- a/tests/commands/test_bump_command.py +++ b/tests/commands/test_bump_command.py @@ -1481,6 +1481,26 @@ def test_bump_get_next(mocker: MockFixture, capsys): assert tag_exists is False +@pytest.mark.usefixtures("tmp_commitizen_project") +def test_bump_get_next_update_changelog_on_bump( + mocker: MockFixture, capsys, config_path +): + create_file_and_commit("feat: new file") + with open(config_path, "a", encoding="utf-8") as fp: + fp.write("update_changelog_on_bump = true\n") + + testargs = ["cz", "bump", "--yes", "--get-next"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(GetNextExit): + cli.main() + + out, _ = capsys.readouterr() + assert "0.2.0" in out + + tag_exists = git.tag_exist("0.2.0") + assert tag_exists is False + + @pytest.mark.usefixtures("tmp_commitizen_project") def test_bump_get_next__changelog_is_not_allowed(mocker: MockFixture): create_file_and_commit("feat: new file")