Extend ASYNC401 to additional exception group assertions - #476
Open
anshurajbisoyi98-ctrl wants to merge 4 commits into
Open
anshurajbisoyi98-ctrl wants to merge 4 commits into
anshurajbisoyi98-ctrl wants to merge 4 commits into
Conversation
jakkdl
reviewed
Oct 5, 2026
|
|
||
| _`ASYNC401` : pytest-raises-exception-group | ||
| ``pytest.raises(ExceptionGroup)`` and ``pytest.raises(BaseExceptionGroup)`` usually hide the structure of exception groups. Prefer ``pytest.RaisesGroup``. | ||
| Bare ``ExceptionGroup`` or ``BaseExceptionGroup`` expectations hide the structure of exception groups. Prefer ``pytest.RaisesGroup`` with explicit expectations for the contained exceptions. This checks ``pytest.raises``, ``pytest.RaisesExc``, ``pytest.RaisesGroup``, and the ``raises`` argument of ``pytest.mark.xfail``, including parameterized exception-group types. |
Member
There was a problem hiding this comment.
this might be more technically correct but is much harder to parse for a casual reader. "Bare ExceptionGroup expectations" is a mouthful and doesn't make me think of 'pytest.raises' until it's listed in the third sentence.
The description also does not need to fully list every single technical case that could trigger it, it's meant to give an easy overview of what the rule is for. Very common LLM:ism in my experience
Author
There was a problem hiding this comment.
Shortened the docs entry back to the original wording and tweaked the message.
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.
Fixes #475. ASYNC401 now catches more exception group assertions. I added regression tests. The ASYNC401 tests pass.