From d563504ebfbc0ccccf13babebba7e3fa9e880406 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py index 81273764d..9fb69b896 100644 --- a/tests/commands/test_bump_command.py +++ b/tests/commands/test_bump_command.py @@ -1480,6 +1480,24 @@ def test_bump_get_next(mocker: MockFixture, capsys): tag_exists = git.tag_exist("0.2.0") 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):