-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[flake8-pytest-style
] Implement pytest.warns diagnostics (PT029
, PT030
, PT031
)
#15444
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
PT031 | 144 | 144 | 0 | 0 | 0 |
PT030 | 28 | 28 | 0 | 0 | 0 |
PT029 | 10 | 10 | 0 | 0 | 0 |
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.
This looks great, thanks.
/// with pytest.warns(MyWarning): | ||
/// setup() | ||
/// func_to_test() # not executed if `setup()` triggers `MyWarning` | ||
/// assert foo() # not executed |
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.
I couldn't figure out from the docs... Is this true? Does the block stop as soon as the warning is triggered? Or is this a copy-paste error from the raises
variant.
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.
That comment was a copy error, apologies!
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.
Are you able to PR a revision to the docs?
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.
On it!
Summary
Implements upstream diagnostics
PT029
,PT030
,PT031
that function as pytest.warns corollaries ofPT010
,PT011
,PT012
respectively. Most of the implementation and documentation is designed to mirror those existing diagnostics.Closes #14239
Test Plan
Tests for
PT029
,PT030
,PT031
largely copied fromPT010
,PT011
,PT012
respectively.cargo nextest run