Skip to content

Commit a11f203

Browse files
feat(bump): make increment option case insensitive
Use str.upper to pre-process the input of --increment
1 parent afa0d93 commit a11f203

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

commitizen/cli.py

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
"name": ["--increment"],
146146
"help": "manually specify the desired increment",
147147
"choices": ["MAJOR", "MINOR", "PATCH"],
148+
"type": str.upper,
148149
},
149150
{
150151
"name": ["--check-consistency", "-cc"],

tests/commands/test_bump_command.py

+21
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,27 @@ def test_bump_major_increment(commit_msg, mocker):
109109
assert tag_exists is True
110110

111111

112+
@pytest.mark.usefixtures("tmp_commitizen_project")
113+
@pytest.mark.parametrize(
114+
"commit_msg,increment,expected_tag",
115+
[
116+
("feat: new file", "PATCH", "0.1.1"),
117+
("fix: username exception", "major", "1.0.0"),
118+
("refactor: remove ini configuration support", "patch", "0.1.1"),
119+
("BREAKING CHANGE: age is no longer supported", "minor", "0.2.0"),
120+
],
121+
)
122+
def test_bump_command_increment_option(commit_msg, increment, expected_tag, mocker):
123+
create_file_and_commit(commit_msg)
124+
125+
testargs = ["cz", "bump", "--increment", increment, "--yes"]
126+
mocker.patch.object(sys, "argv", testargs)
127+
cli.main()
128+
129+
tag_exists = git.tag_exist(expected_tag)
130+
assert tag_exists is True
131+
132+
112133
@pytest.mark.usefixtures("tmp_commitizen_project")
113134
def test_bump_command_prelease(mocker):
114135
# PRERELEASE

0 commit comments

Comments
 (0)