-
Notifications
You must be signed in to change notification settings - Fork 43
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
improve injection code, make backwards compat explicit, make ssl-api explicit #268
Conversation
01435fa
to
199e903
Compare
3 similar comments
199e903
to
8b30c00
Compare
cc098a9
to
58f8742
Compare
I like the function |
Also, have a look at code coverage, not sure what happened but it went down. |
sure. take your time. i my mind having a dedicated place for each injection logic is more readable, especially considering the python- or urllib3-version specific things. |
That's the other thing, I don't think we need to add a new dependency for something as simple as trying to import something from a module. |
sleep on it and ping me tomorrow and I'll take care of whatever decision you come to :) |
I've just had an idea. It would be nice if we had a dictionary of everything we patched, with the real and the mocked version, and use it to bring the status back, instead of using variables to know if I patched or not that thing like it is currently done. |
I'll give it a try |
It could be literally used both ways. As a way to define the monkey-patches and to bring back their counterparts. |
58f8742
to
69c3d16
Compare
ok.
|
69c3d16
to
e485148
Compare
e485148
to
a155190
Compare
Quality Gate passedIssues Measures |
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.
LGTM!
…explicit (#268) * refactor: make injection code more readable and make backwards-compat explicit * refactor: move ssl socket-wrapping code to ssl/socket.py * refactor: convert MocketSSLContext.wrap_socket and wrap_bio to instance-methods * refactor: MocketSSLSocket use proper ssl-context instead of urllib3
This PR introduces the following changes:
ssl.context.mock_wrap_socket
to mirror stdlib apiMocketSSLContext.wrap_socket
and.wrap_bio
to instance-methods to mirror stdlib apiurllib3.mock_ssl_wrap_socket
methods mirror urllib3 apissl.SSLContext
inMocketSSLSocket
instead ofurllib3.ssl_wrap_socket