fix: add match parameter to pytest.warns to resolve PT030 by HankyStyle · Pull Request #1828 · commitizen-tools/commitizen · GitHub
Skip to content

fix: add match parameter to pytest.warns to resolve PT030 - #1828

Merged
bearomorphism merged 1 commit into
commitizen-tools:next-releasefrom
HankyStyle:fix/add-match-regex-parameter
Jan 31, 2026
Merged

fix: add match parameter to pytest.warns to resolve PT030#1828
bearomorphism merged 1 commit into
commitizen-tools:next-releasefrom
HankyStyle:fix/add-match-regex-parameter

Conversation

@HankyStyle

@HankyStyle HankyStyle commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

Description

This PR addresses ruff rule PT030 ("pytest.warns() is too broad") in the test suite.

Before
image

After
image

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (gemini 3 pro)

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Expected Behavior

  • Use pytest.warns(DeprecationWarning, match=r".*--version-type.*deprecated") instead of a generic catch.
  • Running uv run ruff check should pass without PT030 errors.
  • The tests should correctly identify and match the "version-type is deprecated" warning.

Steps to Test This Pull Request

  1. Run linting check to ensure PT030 is resolved:
    uv run ruff check

Additional Context

@bearomorphism
bearomorphism merged commit ef78ba4 into commitizen-tools:next-release Jan 31, 2026
18 checks passed
bearomorphism pushed a commit that referenced this pull request Jan 31, 2026
Co-authored-by: 余翰承 <hankyu@yuhanchengdeMacBook-Air.local>
@bearomorphism

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Jan 31, 2026

Copy link
Copy Markdown

bearomorphism pushed a commit that referenced this pull request Feb 1, 2026
Co-authored-by: 余翰承 <hankyu@yuhanchengdeMacBook-Air.local>
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.

2 participants