Run the assertion in test_add_extras_only_accepts_one_package - #11055
Merged
radoering merged 1 commit intoSep 11, 2026
Conversation
The assertion sat inside the `with pytest.raises(...)` block, after the call that raises, so it never ran and the message it claims to check was unchecked. Moving it out is enough; it passes, and fails if the expected message is changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
radoering
approved these changes
Sep 11, 2026
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.
The assertion in
test_add_extras_only_accepts_one_packagesits inside thewith pytest.raises(...)block, after the call that raises:tester.execute(command)raises, so control leaves the block and the assertion below it never runs. The test still passes, but only becausepytest.raisescaught theValueError; the message it names is unchecked.Moving it out of the block is the whole change. It passes there, and it now fails if the expected message is wrong (changing the expected string gives
assert 'You can only...extras option' == 'NOT THE REAL MESSAGE').tests/console/commands/test_add.py: 84 passed.ruff checkandruff formatclean.Found with an AST scan for assertions positioned after the raising statement inside a
pytest.raisesblock. It was the only one in the repository.This PR was written with AI assistance (Claude Code), including the scan and the verification above.