-
Notifications
You must be signed in to change notification settings - Fork 109
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
B017: False negative when "from" imports used #418
Comments
Nice find. Will happily take a fix to include supporting this. |
I'm interested in doing a PR for this fix, however I have a question about how best to go about avoiding false positives. The most obvious solution modifies the check for After looking further into the code, the most straightforward solution, to me, seems to me
I want to make sure this approach is a reasonable solution before I get too far into the development, particularly the changes to |
… imported directly from pytest (#424) * handle ast.ImportFrom nodes in b005 check to add this to the list of imports * work out logic to determine if ast.Name node "raises" correspondes to the pytest.raises package * integrate new logic for B017 to the check itself * add check for matches keyword to prevent B017; whitespace corrections to pass tests * update tests to capture changes to B017 logic * files modified by pre-commit
Summary
B017 fails when raises is imported directly
Version
Replicated on version
23.9.16
Sample code
The text was updated successfully, but these errors were encountered: