|
16 | 16 | from tests.utils import create_file_and_commit
|
17 | 17 |
|
18 | 18 |
|
| 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 | +) |
19 | 30 | @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"] |
24 | 34 | testargs = ["cz", "bump", "--yes"]
|
25 | 35 | mocker.patch.object(sys, "argv", testargs)
|
26 | 36 | cli.main()
|
| 37 | + tag_exists = git.tag_exist("0.1.1") |
| 38 | + assert tag_exists is True |
| 39 | + |
27 | 40 |
|
| 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() |
28 | 48 | tag_exists = git.tag_exist("0.2.0")
|
29 | 49 | assert tag_exists is True
|
30 | 50 |
|
31 |
| - # PATCH |
32 |
| - create_file_and_commit("fix: username exception") |
33 | 51 |
|
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"] |
35 | 67 | mocker.patch.object(sys, "argv", testargs)
|
36 | 68 | cli.main()
|
37 | 69 |
|
38 |
| - tag_exists = git.tag_exist("0.2.1") |
| 70 | + tag_exists = git.tag_exist("1.0.0") |
39 | 71 | assert tag_exists is True
|
40 | 72 |
|
| 73 | + |
| 74 | +@pytest.mark.usefixtures("tmp_commitizen_project") |
| 75 | +def test_bump_command_prelease(mocker): |
41 | 76 | # PRERELEASE
|
42 | 77 | create_file_and_commit("feat: location")
|
43 | 78 |
|
44 |
| - testargs = ["cz", "bump", "--prerelease", "alpha"] |
| 79 | + testargs = ["cz", "bump", "--prerelease", "alpha", "--yes"] |
45 | 80 | mocker.patch.object(sys, "argv", testargs)
|
46 | 81 | cli.main()
|
47 | 82 |
|
48 |
| - tag_exists = git.tag_exist("0.3.0a0") |
| 83 | + tag_exists = git.tag_exist("0.2.0a0") |
49 | 84 | assert tag_exists is True
|
50 | 85 |
|
51 | 86 | # PRERELEASE BUMP CREATES VERSION WITHOUT PRERELEASE
|
52 | 87 | testargs = ["cz", "bump"]
|
53 | 88 | mocker.patch.object(sys, "argv", testargs)
|
54 | 89 | cli.main()
|
55 | 90 |
|
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") |
69 | 92 | assert tag_exists is True
|
70 | 93 |
|
71 | 94 |
|
|
0 commit comments