Skip to content

Comments

Fix -v hint in raises match diff not working#14226

Open
worksbyfriday wants to merge 2 commits intopytest-dev:mainfrom
worksbyfriday:fix-raises-verbose-hint
Open

Fix -v hint in raises match diff not working#14226
worksbyfriday wants to merge 2 commits intopytest-dev:mainfrom
worksbyfriday:fix-raises-verbose-hint

Conversation

@worksbyfriday
Copy link

Summary

  • _check_match called _diff_text without passing verbosity, so verbose always defaulted to 0
  • The "Skipping N identical leading characters in diff, use -v to show" hint was non-functional
  • Now reads VERBOSITY_ASSERTIONS from the module-level _config set during test protocol

Test plan

  • Added pytester integration test verifying:
    • Without -v: output contains "Skipping ... identical leading characters"
    • With -v: output shows full diff without truncation
  • All 66 existing TestRaises tests pass

Fixes #14214.

🤖 Generated with Claude Code

worksbyfriday and others added 2 commits February 22, 2026 09:19
The `-v` hint in `pytest.raises(match=...)` diff output was non-functional
because `_check_match` called `_diff_text` without passing the verbosity
level from the pytest config. Read `VERBOSITY_ASSERTIONS` from the
module-level `_config` set during test protocol.

Fixes pytest-dev#14214.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-v hint shown in raises diff, but verbosity not propagated in raises.py

1 participant