-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Replace InsecureRequestWarning with standard logs #7512
Conversation
Codecov Report
|
if level == logging.WARNING and message == expected_message: | ||
break | ||
else: | ||
raise AssertionError('Expected WARNING log with message `{}`'.format(expected_message)) |
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.
(nit)
Looks like we are repeating a lot of logic like this in test.
Maybe we should have some kind of utils to avoid duplication.
expected_message = 'An unverified HTTPS request is being made to https://www.google.com'
for _, level, message in caplog.record_tuples:
if level == logging.WARNING and message == expected_message:
break
else:
raise AssertionError('Expected WARNING log with message `{}`'.format(expected_message))
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.
good idea, I'll add one in a separate PR after this is merged
Motivation
Make the warning granular per request without modifying global interpreter state
Additional Notes
Based on https://urllib3.readthedocs.io/en/latest/user-guide.html#certificate-verification, you set the SSL verification method via the constant's name: