-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-125522: Fix bare except in test_uuid
#129018
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ def importable(name): | |
try: | ||
__import__(name) | ||
return True | ||
except: | ||
except ModuleNotFoundError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure this is the only exception type that can come from I guess since it's a test it's fine to assume (if the tests pass). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not 100% sure, but I think anything else would be unexpected here and would warrant looking into |
||
return False | ||
|
||
|
||
|
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.
If you want to be maximally pedantic you can go even more specific:
Eg if a module is successfully found but then imports another module which isn't found, this will raise but the code in the PR will not
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.
There's only one other place in the repo that looks at
e.name
so this seems to be a pretty uncommon pattern and maybe not worth for test code? Though I don't have a strong preference either way :)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.
Yeah I'm cool with it either way
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.
Alright, I'll keep it as is for now and let's see what other reviewers think :)