Skip to content

docs: add plugin testing guide#1911

Open
sedat4ras wants to merge 2 commits intocommitizen-tools:masterfrom
sedat4ras:docs/plugin-testing-guide
Open

docs: add plugin testing guide#1911
sedat4ras wants to merge 2 commits intocommitizen-tools:masterfrom
sedat4ras:docs/plugin-testing-guide

Conversation

@sedat4ras
Copy link

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 commitizen test suite — this guide makes that knowledge explicit.

What's covered:

  • Testing bump_pattern / bump_map with commitizen.bump.find_increment
  • Testing changelog_pattern and commit_parser with regex matching
  • Testing message() output against expected commit strings
  • Testing schema_pattern() validation

The page is added to the nav in mkdocs.yml under the Customization section.

Checklist

  • I have read the contributing guidelines
  • Yes, generative AI tooling (Claude) was used to co-author this PR

Generated-by: Claude following the guidelines

Documentation Changes

  • Update the documentation for the changes
  • Check and fix any broken links — all links reference existing pages or external URLs

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) and tests/test_bump_find_increment.py which show the same patterns internally.

sedat4ras and others added 2 commits March 23, 2026 22:22
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add guidelines regarding how to test plugins

1 participant