Ensure exception notes are ignored for pytest < 8#16886
Merged
pllim merged 1 commit intoastropy:mainfrom Aug 26, 2024
Merged
Conversation
Contributor
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
pllim
reviewed
Aug 26, 2024
| if not (PYTEST_LT_8_0 and sys.version_info >= (3, 11)): | ||
| # For python>=3.11, we use Exception.add_note, which | ||
| # pytest < 8 does not know how to deal with. | ||
| msg += ".*\n.*treated as dimensionless" |
Member
There was a problem hiding this comment.
My regex-fu isn't that strong but I thought usually having a \ in the match needs raw string?
Contributor
Author
There was a problem hiding this comment.
Here, I do want the \n be interpreted as new-line. Happy it worked!
pllim
approved these changes
Aug 26, 2024
Member
pllim
left a comment
There was a problem hiding this comment.
Since CI now green (failures unrelated), I guess maybe we don't need raw string after all. 🤷♀️ Let's merge then. Thanks for the quick fix!
This was referenced Aug 28, 2024
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.
As an alternative to #16885, which requires pytest >=8, this PR ensures exception notes are ignored for pytest < 8. This maybe is the easiest fix, since #16885 really should include removing any usage of
PYTEST_LT_8_0.Fixes #16884