Skip to content

Mocking https connections fails when pyOpenSSL is installed #65

@kennydo

Description

@kennydo

If I pip install pyOpenSSL==17.5.0 and then run the pytest tests/main/test_https.py, I get an exception that looks like this:

if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
>               raise SSLError(e, request=request)
E               requests.exceptions.SSLError: HTTPSConnectionPool(host='testme.org', port=443): Max retries exceeded with url: /json (Caused by SSLError(SSLError("bad handshake: SysCallError(9, 'EBADF')",),))

urllib3 does some things differently when it detects that the OpenSSL module is available. I found prior art in getting mocking of pyOpenSSL in HTTPretty (https://github.com/gabrielfalcao/HTTPretty/pull/215/files) but it looks pretty gnarly.

Is adding support for environments with PyOpenSSL installed anywhere on the roadmap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions