Closed ghost closed 3 years ago
We are also experiencing this. Our tests were working fine last week but stopped several days ago. The cause appears to be urllib3
1.26.5. If I downgrade to 1.26.4, the tests pass.
Thanks for the feedback. Something changed in the way urllib3
deals with HTTPS, I need to spend some time on it.
This is what they claim they did:
1.26.5 (2021-05-26)
Fixed deprecation warnings emitted in Python 3.10.
Updated vendored six library to 1.16.0.
Improved performance of URL parser when splitting the authority component.
This is the difference between the two versions: https://github.com/urllib3/urllib3/compare/1.26.4...1.26.5
My 2cents
As a partial solution, we have mocked urllib3.connection.match_hostname
to silence this and it works.
This function consumes SSLSocket.getpeercert
(override by MocketSocket?) around these functions should be the error.
@mock.patch("urllib3.connection.match_hostname", side_effect=None)
I bet this will help me to fix the issue. I was trying to make it happen patching the SSLContext
but I was struggling at that.
It looks like it was not the only issue brought by the urllib3
upgrade.
Here is a new version compatible with the current urllib3
: https://pypi.org/project/mocket/3.9.42/
It has been hard but I managed to remove some code and make the rest simpler.
Describe the bug Mocket on version
3.9.41
is not working well with HTTPS URLs.To Reproduce Steps to reproduce the behavior: it's failing your test
tests/main/test_httpretty.py::test_rotating_responses_with_requests
.We have reproduced with these tests:
Expected behavior It should mock HTTPS requests too.
Docker image (please complete the following information):
Additional context