8000 test(bump): Add commit-msgs for different increments · AnarchyCrew/commitizen@38a1c60 · GitHub
[go: up one dir, main page]

Skip to content

Commit 38a1c60

Browse files
committed
test(bump): Add commit-msgs for different increments
1 parent b207e6d commit 38a1c60

File tree

1 file changed

+46
-23
lines changed

1 file changed

+46
-23
lines changed

tests/commands/test_bump_command.py

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,79 @@
1616
from tests.utils import create_file_and_commit
1717

1818

19+
@pytest.mark.parametrize(
20+
"commit_msg",
21+
(
22+
"fix: username exception",
23+
"fix(user): username exception",
24+
"refactor: remove ini configuration support",
25+
"refactor(config): remove ini configuration support",
26+
"perf: update to use multiproess",
27+
"perf(worker): update to use multiproess",
28+
),
29+
)
1930
@pytest.mark.usefixtures("tmp_commitizen_project")
20-
def test_bump_command(mocker):
21-
# MINOR
22-
create_file_and_commit("feat: new file")
23-
31+
def test_bump_patch_increment(commit_msg, mocker):
32+
create_file_and_commit(commit_msg)
33+
# testargs = ["cz", "bump"]
2434
testargs = ["cz", "bump", "--yes"]
2535
mocker.patch.object(sys, "argv", testargs)
2636
cli.main()
37+
tag_exists = git.tag_exist("0.1.1")
38+
assert tag_exists is True
39+
2740

41+
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
42+
@pytest.mark.usefixtures("tmp_commitizen_project")
43+
def test_bump_minor_increment(commit_msg, mocker):
44+
create_file_and_commit(commit_msg)
45+
testargs = ["cz", "bump", "--yes"]
46+
mocker.patch.object(sys, "argv", testargs)
47+
cli.main()
2848
tag_exists = git.tag_exist("0.2.0")
2949
assert tag_exists is True
3050

31-
# PATCH
32-
create_file_and_commit("fix: username exception")
3351

34-
testargs = ["cz", "bump"]
52+
@pytest.mark.usefixtures("tmp_commitizen_project")
53+
@pytest.mark.parametrize(
54+
"commit_msg",
55+
(
56+
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported",
57+
"feat(user): new user interface\n\nBREAKING CHANGE: age is no longer supported",
58+
"BREAKING CHANGE: age is no longer supported",
59+
"BREAKING-CHANGE: age is no longer supported",
60+
"age is not longer supported!",
61+
),
62+
)
63+
def test_bump_major_increment(commit_msg, mocker):
64+
create_file_and_commit(commit_msg)
65+
66+
testargs = ["cz", "bump", "--yes"]
3567
mocker.patch.object(sys, "argv", testargs)
3668
cli.main()
3769

38-
tag_exists = git.tag_exist("0.2.1")
70+
tag_exists = git.tag_exist("1.0.0")
3971
assert tag_exists is True
4072

73+
74+
@pytest.mark.usefixtures("tmp_commitizen_project")
75+
def test_bump_command_prelease(mocker):
4176
# PRERELEASE
4277
create_file_and_commit("feat: location")
4378

44-
testargs = ["cz", "bump", "--prerelease", "alpha"]
79+
testargs = ["cz", "bump", "--prerelease", "alpha", "--yes"]
4580
mocker.patch.object(sys, "argv", testargs)
4681
cli.main()
4782

48-
tag_exists = git.tag_exist("0.3.0a0")
83+
tag_exists = git.tag_exist("0.2.0a0")
4984
assert tag_exists is True
5085

5186
# PRERELEASE BUMP CREATES VERSION WITHOUT PRERELEASE
5287
testargs = ["cz", "bump"]
5388
mocker.patch.object(sys, "argv", testargs)
5489
cli.main()
5590

56-
tag_exists = git.tag_exist("0.3.0")
57-
assert tag_exists is True
58-
59-
# MAJOR
60-
create_file_and_commit(
61-
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported"
62-
)
63-
64-
testargs = ["cz", "bump"]
65-
mocker.patch.object(sys, "argv", testargs)
66-
cli.main()
67-
68-
tag_exists = git.tag_exist("1.0.0")
91+
tag_exists = git.tag_exist("0.2.0")
6992
assert tag_exists is True
7093

7194

0 commit comments

Comments
 (0)
0