From 67634e36b2c72256ad8a4796ffa59805e8863e50 Mon Sep 17 00:00:00 2001 From: Adrian DC Date: 2024年8月13日 17:35:37 +0200 Subject: [PATCH 1/3] test(cz_customize): add missing YAML configuration file tests Signed-off-by: Adrian DC --- tests/test_cz_customize.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_cz_customize.py b/tests/test_cz_customize.py index 933b1aa065..6001152709 100644 --- a/tests/test_cz_customize.py +++ b/tests/test_cz_customize.py @@ -321,6 +321,7 @@ params=[ TomlConfig(data=TOML_STR, path="not_exist.toml"), JsonConfig(data=JSON_STR, path="not_exist.json"), + YAMLConfig(data=YAML_STR, path="not_exist.yaml"), ] ) def config(request): From 9d4a67316a05fb257e257760fbf9619088329ba1 Mon Sep 17 00:00:00 2001 From: Adrian DC Date: 2024年8月13日 18:53:52 +0200 Subject: [PATCH 2/3] test(cz_customize): fix YAML test and docs configurations quotes> commitizen.exceptions.InvalidConfigurationError: Failed to parse not_exist.yaml: while scanning a double-quoted scalar> found unknown escape character 's' Signed-off-by: Adrian DC --- docs/customization.md | 14 +++++++------- tests/test_cz_customize.py | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/customization.md b/docs/customization.md index df77171077..99ffd39ba7 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -110,13 +110,13 @@ And the correspondent example for a yaml file: commitizen: name: cz_customize customize: - message_template: "{{change_type}}:{% if show_message %} {{message}}{% endif %}" + message_template: '{{change_type}}:{% if show_message %} {{message}}{% endif %}' example: 'feature: this feature enable customize through config file' - schema: ":
" - schema_pattern: "(feature|bug fix):(\\s.*)" - bump_pattern: "^(break|new|fix|hotfix)" - commit_parser: "^(?Pfeature|bug fix):\\s(?P.*)?" - changelog_pattern: "^(feature|bug fix)?(!)?" + schema: ': ' + schema_pattern: '(feature|bug fix):(\\s.*)' + bump_pattern: '^(break|new|fix|hotfix)' + commit_parser: '^(?Pfeature|bug fix):\\s(?P.*)?' + changelog_pattern: '^(feature|bug fix)?(!)?' change_type_map: feature: Feat bug fix: Fix @@ -125,7 +125,7 @@ commitizen: new: MINOR fix: PATCH hotfix: PATCH - change_type_order: ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"] + change_type_order: ['BREAKING CHANGE', 'feat', 'fix', 'refactor', 'perf'] info_path: cz_customize_info.txt info: This is customized info questions: diff --git a/tests/test_cz_customize.py b/tests/test_cz_customize.py index 6001152709..055b2d6277 100644 --- a/tests/test_cz_customize.py +++ b/tests/test_cz_customize.py @@ -105,17 +105,17 @@ - commitizen/__version__.py - pyproject.toml customize: - message_template: "{{change_type}}:{% if show_message %} {{message}}{% endif %}" + message_template: '{{change_type}}:{% if show_message %} {{message}}{% endif %}' example: 'feature: this feature enables customization through a config file' - schema: ": " - schema_pattern: "(feature|bug fix):(\\s.*)" - bump_pattern: "^(break|new|fix|hotfix)" + schema: ': ' + schema_pattern: '(feature|bug fix):(\\s.*)' + bump_pattern: '^(break|new|fix|hotfix)' bump_map: break: MAJOR new: MINOR fix: PATCH hotfix: PATCH - change_type_order: ["perf", "BREAKING CHANGE", "feat", "fix", "refactor"] + change_type_order: ['perf', 'BREAKING CHANGE', 'feat', 'fix', 'refactor'] info: This is a customized cz. questions: - type: list From 74228d1c620b29ea83e78974e4487527d5a82465 Mon Sep 17 00:00:00 2001 From: Adrian DC Date: 2024年8月13日 18:54:21 +0200 Subject: [PATCH 3/3] test(cz_customize): fix missing YAML test keys against JSON/TOML> test_commit_parser[config2] - AssertionError:> assert '(?P.*)' == '^(?P.*)?'> test_changelog_pattern[config2] - AssertionError:> assert '.*' == '^(feature|bug fix)?(!)?'> test_change_type_map[config2] - AssertionError:> assert None == {'bug fix': 'Fix', 'feature': 'Feat'} Signed-off-by: Adrian DC --- tests/test_cz_customize.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_cz_customize.py b/tests/test_cz_customize.py index 055b2d6277..60a56f147f 100644 --- a/tests/test_cz_customize.py +++ b/tests/test_cz_customize.py @@ -110,6 +110,11 @@ schema: ': ' schema_pattern: '(feature|bug fix):(\\s.*)' bump_pattern: '^(break|new|fix|hotfix)' + commit_parser: '^(?Pfeature|bug fix):\\s(?P.*)?' + changelog_pattern: '^(feature|bug fix)?(!)?' + change_type_map: + feature: Feat + bug fix: Fix bump_map: break: MAJOR new: MINOR

AltStyle によって変換されたページ (->オリジナル) /