-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Have pytest.raises match against exception __notes__
#11227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0dcb4b9
Proof of concept
ivirshup a74243a
Suppport older versions of python
ivirshup 6e51063
Docs
ivirshup 3c0ea82
Add link to PEP-678
ivirshup c0245c7
type tests (apply suggestions from review)
ivirshup 4511468
Add self to authors
ivirshup 2516392
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9c3ee7d
Add changelog entry
ivirshup f72af74
Merge branch 'match-exception-notes' of https://github.com/ivirshup/p…
ivirshup 55937a8
Merge branch 'main' into match-exception-notes
ivirshup d4c62de
Add test cases for passing compiled regex
ivirshup 5c29a82
Type annotation fix + subsequent pyupgrade, autoflake
ivirshup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Allow :func:`pytest.raises` ``match`` argument to match against `PEP-678 <https://peps.python.org/pep-0678/>` ``__notes__``. |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to work with @agronholm to ensure note helpers in the backport as well as shared formatting as follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests here don't seem to involve exception groups though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agronholm my impression is that exception notes are closely related and my understanding is that integration with the backport may be helpful as per agronholm/exceptiongroup#31 and since formatting may also be affected my impression is that the most benefit for library users would come from having one integration place instead of multiple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About formatting: I don't think there is a function in traceback that provides the exact rendering pytest expects. I think all the methods that
traceback
provides will include the exception type.