From b72eb695ad2c0d39a3c2634d0bde1cd58f2f06cb Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Sat, 1 Feb 2020 19:37:38 +0800 Subject: [PATCH 1/2] test(commands/check): add test case for checking bump message in conventional commit --- tests/commands/test_check_command.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py index c5bed35e61..a53e57b495 100644 --- a/tests/commands/test_check_command.py +++ b/tests/commands/test_check_command.py @@ -93,11 +93,19 @@ def test_check_no_conventional_commit(config, mocker, tmpdir): error_mock.assert_called_once() -def test_check_conventional_commit(config, mocker, tmpdir): +@pytest.mark.parametrize( + "commit_msg", + ( + "feat(lang): added polish language", + "feat: add polish language", + "bump: 0.0.1 -> 1.0.0", + ), +) +def test_check_conventional_commit(commit_msg, config, mocker, tmpdir): success_mock = mocker.patch("commitizen.out.success") tempfile = tmpdir.join("temp_commit_file") - tempfile.write("feat(lang): added polish language") + tempfile.write(commit_msg) check_cmd = commands.Check(config=config, arguments={"commit_msg_file": tempfile}) From 7eb8afaaf7dd7b55ad98d0fcb4570d0e9ffbc294 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Sat, 1 Feb 2020 19:38:01 +0800 Subject: [PATCH 2/2] fix(commands/check): add bump into valid commit message of convention commit pattern --- commitizen/cz/conventional_commits/conventional_commits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commitizen/cz/conventional_commits/conventional_commits.py b/commitizen/cz/conventional_commits/conventional_commits.py index 14e76393d9..c67b2a5a0d 100644 --- a/commitizen/cz/conventional_commits/conventional_commits.py +++ b/commitizen/cz/conventional_commits/conventional_commits.py @@ -171,7 +171,7 @@ def schema(self) -> str: def schema_pattern(self) -> str: PATTERN = ( - r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)" + r"(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)" r"(\([\w\-]+\))?:\s.*" ) return PATTERN