Uh oh!
There was an error while loading. Please reload this page.
test: use match in pytest.raises - #1846
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #1846 +/- ##
=======================================
Coverage 98.23% 98.23% =======================================
Files 61 61 Lines 2779 2779 =======================================
Hits 2730 2730 Misses 49 49 ☔ View full report in Codecov by Sentry. |
9daaf1b to
37d09f7CompareThere was a problem hiding this comment.
Pull request overview
Updates the test suite to use pytest.raises(..., match=...) for asserting exception messages, reducing post-raises string assertions and making error-message checks more idiomatic.
Changes:
- Replaced
excinfo-based string assertions withpytest.raises(..., match=...)across multiple tests. - Added
re.escape(...)in some places to safely match literal strings (e.g., filenames/paths) in regex-basedmatch. - Minor cleanup in tests (e.g., removing unused captured stderr variable, using
check=Trueinsubprocess.run).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_git.py | Uses match= for GitCommandError assertion. |
| tests/test_factory.py | Uses match= for factory failure exception message. |
| tests/test_cz_customize.py | Uses match= for missing customize config error message. |
| tests/test_conf.py | Adds re and uses re.escape in match= for invalid config filename checks. |
| tests/test_cli.py | Converts several raises assertions to match=, plus small cleanups. |
| tests/test_changelog.py | Uses match= for changelog-related exceptions. |
| tests/test_bump_update_version_in_files.py | Adds re and converts consistency error assertions to match=. |
| tests/commands/test_commit_command.py | Adds re and converts several commit-command exception assertions to match=. |
| tests/commands/test_check_command.py | Converts various check-command exception assertions to match= (including multi-message case). |
| tests/commands/test_changelog_command.py | Uses match= for missing revision range case. |
| tests/commands/test_bump_command.py | Converts bump-command exception assertions to match= in multiple scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Lee-W
left a comment
There was a problem hiding this comment.
mostly good, a few nits from copilot
Uh oh!
There was an error while loading. Please reload this page.
bearomorphism
commented
May 11, 2026
Hi @Lee-W, addressed all the Copilot review comments and rebased onto latest
Note on CIThe All tests touched by this PR pass locally on Python 3.14.5; ruff + mypy are clean. |
bearomorphism
commented
May 11, 2026
Update on the unrelated 3.14 failure: confirmed it's Python 3.14.5 — released yesterday (2026-05-10) — landing CPython gh-130750:
So 3.14.0–3.14.4 emitted |
Uh oh!
There was an error while loading. Please reload this page.
Description
Use
matchparameter inpytest.raisesand remove verbose string assertions.Was generative AI tooling used to co-author this PR?
Used
cursoragent mode to assist this task.