docs: add plugin testing guide#1911
Open
sedat4ras wants to merge 2 commits intocommitizen-tools:masterfrom
Open
docs: add plugin testing guide#1911sedat4ras wants to merge 2 commits intocommitizen-tools:masterfrom
sedat4ras wants to merge 2 commits intocommitizen-tools:masterfrom
Conversation
Closes commitizen-tools#819 When a dependency shares the same version as the project, Commitizen's version_files replacement will match both. Add a FAQ section explaining: - Option 1: anchor the version_files pattern with ^ to match line starts - Option 2 (recommended): use version_provider to avoid regex matching entirely Co-authored-by: Claude <noreply@anthropic.com>
Closes commitizen-tools#937 Add a new page (docs/customization/testing_plugins.md) explaining how to write a test suite for a Commitizen plugin. Covers: - Testing bump_pattern / bump_map with bump.find_increment - Testing changelog_pattern and commit_parser with regex matching - Testing message() output against expected commit strings - Testing schema validation Also adds the page to the nav in mkdocs.yml under Customization. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a new documentation page (
docs/customization/testing_plugins.md) with a practical guide for writing a test suite for Commitizen plugins.Closes #937
The issue author (@ghisvail) noted that while the plugin development docs are excellent, there's no guidance on how to test a plugin to prevent regressions. The answer was to look at scattered examples in the main
commitizentest suite — this guide makes that knowledge explicit.What's covered:
bump_pattern/bump_mapwithcommitizen.bump.find_incrementchangelog_patternandcommit_parserwith regex matchingmessage()output against expected commit stringsschema_pattern()validationThe page is added to the nav in
mkdocs.ymlunder the Customization section.Checklist
Generated-by: Claude following the guidelines
Documentation Changes
Expected Behavior
Plugin authors will find clear, copy-pasteable test patterns without having to dig through Commitizen's own test suite.
Additional Context
Builds on the examples in
tests/conftest.py(e.g.,SemverCommitizen) andtests/test_bump_find_increment.pywhich show the same patterns internally.