/vagrant/borg/truststore-env/lib/python3.10/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
============================= test session starts ==============================
platform darwin -- Python 3.10.2, pytest-8.3.3, pluggy-1.5.0 -- /vagrant/borg/truststore-env/bin/python3
cachedir: .pytest_cache
rootdir: /vagrant/borg/truststore
configfile: pyproject.toml
plugins: anyio-4.6.0, flaky-3.8.1, asyncio-0.24.0, pytest_httpserver-1.1.0
asyncio: mode=strict, default_loop_scope=None
collecting ... collected 64 items

tests/test_api.py::test_success[example.com] PASSED
tests/test_api.py::test_success[1.1.1.1] PASSED
tests/test_api.py::test_failures[wrong.host.badssl.com] PASSED
tests/test_api.py::test_failures[expired.badssl.com] PASSED
tests/test_api.py::test_failures[self-signed.badssl.com] PASSED
tests/test_api.py::test_failures[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_failures[superfish.badssl.com] PASSED
tests/test_api.py::test_failures[revoked.badssl.com] FAILED
tests/test_api.py::test_success_after_loading_additional_anchors[example.com] PASSED
tests/test_api.py::test_success_after_loading_additional_anchors[1.1.1.1] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[wrong.host.badssl.com] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[expired.badssl.com] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[self-signed.badssl.com] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[superfish.badssl.com] PASSED
tests/test_api.py::test_failure_after_loading_additional_anchors[revoked.badssl.com] FAILED
tests/test_api.py::test_failures_without_revocation_checks[wrong.host.badssl.com] PASSED
tests/test_api.py::test_failures_without_revocation_checks[expired.badssl.com] PASSED
tests/test_api.py::test_failures_without_revocation_checks[self-signed.badssl.com] PASSED
tests/test_api.py::test_failures_without_revocation_checks[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_failures_without_revocation_checks[superfish.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_success[example.com] PASSED
tests/test_api.py::test_sslcontext_api_success[1.1.1.1] SKIPPED (url...)
tests/test_api.py::test_sslcontext_api_success_async[example.com] PASSED
tests/test_api.py::test_sslcontext_api_success_async[1.1.1.1] PASSED
tests/test_api.py::test_sslcontext_api_failures[wrong.host.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures[expired.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures[self-signed.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures[superfish.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures[revoked.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[wrong.host.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[expired.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[self-signed.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[superfish.badssl.com] PASSED
tests/test_api.py::test_sslcontext_api_failures_async[revoked.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_success[example.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_success[1.1.1.1] SKIPPED
tests/test_api.py::test_requests_sslcontext_api_failures[wrong.host.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_failures[expired.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_failures[self-signed.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_failures[untrusted-root.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_failures[superfish.badssl.com] PASSED
tests/test_api.py::test_requests_sslcontext_api_failures[revoked.badssl.com] PASSED
tests/test_api.py::test_trustme_cert PASSED
tests/test_api.py::test_trustme_cert_loaded_via_capath PASSED
tests/test_api.py::test_trustme_cert_still_uses_system_certs PASSED
tests/test_api.py::test_macos_10_7_import_error PASSED
tests/test_custom_ca.py::test_urllib3_custom_ca PASSED
tests/test_custom_ca.py::test_aiohttp_custom_ca PASSED
tests/test_custom_ca.py::test_requests_custom_ca PASSED
tests/test_inject.py::test_inject_and_extract PASSED
tests/test_inject.py::test_success_with_inject[example.com] PASSED
tests/test_inject.py::test_success_with_inject[1.1.1.1] PASSED
tests/test_inject.py::test_inject_set_values PASSED
tests/test_inject.py::test_urllib3_works_with_inject PASSED
tests/test_inject.py::test_aiohttp_works_with_inject FAILED
tests/test_inject.py::test_requests_works_with_inject PASSED
tests/test_inject.py::test_sync_httpx_works_with_inject PASSED
tests/test_inject.py::test_async_httpx_works_with_inject PASSED
tests/test_sslcontext.py::test_minimum_maximum_version PASSED
tests/test_sslcontext.py::test_check_hostname_false FAILED
tests/test_sslcontext.py::test_verify_mode_cert_none PASSED

=================================== FAILURES ===================================
______________________ test_failures[revoked.badssl.com] _______________________

failure = FailureHost(host='revoked.badssl.com', error_messages=['“revoked.badssl.com” certificate is revoked', 'Unknown error occurred', 'The certificate is revoked.'])

    @failure_hosts
    def test_failures(failure):
        with pytest.raises(ssl.SSLCertVerificationError) as e:
            connect_to_host(failure.host)
    
        error_repr = repr(e.value)
>       assert any(message in error_repr for message in failure.error_messages), error_repr
E       AssertionError: SSLCertVerificationError('Recoverable trust failure occurred')
E       assert False
E        +  where False = any(<generator object test_failures.<locals>.<genexpr> at 0x10b37f680>)

tests/test_api.py:239: AssertionError
______ test_failure_after_loading_additional_anchors[revoked.badssl.com] _______

failure = FailureHost(host='revoked.badssl.com', error_messages=['“revoked.badssl.com” certificate is revoked', 'Unknown error occurred', 'The certificate is revoked.'])
trustme_ca = <trustme.CA object at 0x10bf2b220>

    @failure_hosts
    def test_failure_after_loading_additional_anchors(failure, trustme_ca):
        with (
            pytest.raises(ssl.SSLCertVerificationError) as e,
            socket.create_connection((failure.host, 443)) as sock,
        ):
            ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
    
            # See if loading additional anchors still fails.
            trustme_ca.configure_trust(ctx)
            with ctx.wrap_socket(sock, server_hostname=failure.host):
                pass
    
        error_repr = repr(e.value)
>       assert any(message in error_repr for message in failure.error_messages), error_repr
E       AssertionError: SSLCertVerificationError('Recoverable trust failure occurred')
E       assert False
E        +  where False = any(<generator object test_failure_after_loading_additional_anchors.<locals>.<genexpr> at 0x10befa8f0>)

tests/test_api.py:267: AssertionError
________________________ test_aiohttp_works_with_inject ________________________

self = <aiohttp.connector.TCPConnector object at 0x10cb08dc0>, addr_infos = []
req = <aiohttp.client_reqrep.ClientRequest object at 0x10cb08460>
timeout = ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=30, ceil_threshold=5)
client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>
args = (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=False closed=False debug=False>),)
kwargs = {'server_hostname': 'localhost', 'ssl': <ssl.SSLContext object at 0x10ad37b40>}
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6>

    async def _wrap_create_connection(
        self,
        *args: Any,
        addr_infos: List[aiohappyeyeballs.AddrInfoType],
        req: ClientRequest,
        timeout: "ClientTimeout",
        client_error: Type[Exception] = ClientConnectorError,
        **kwargs: Any,
    ) -> Tuple[asyncio.Transport, ResponseHandler]:
        try:
            async with ceil_timeout(
                timeout.sock_connect, ceil_threshold=timeout.ceil_threshold
            ):
                sock = await aiohappyeyeballs.start_connection(
                    addr_infos=addr_infos,
                    local_addr_infos=self._local_addr_infos,
                    happy_eyeballs_delay=self._happy_eyeballs_delay,
                    interleave=self._interleave,
                    loop=self._loop,
                )
>               return await self._loop.create_connection(*args, **kwargs, sock=sock)

../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:1098: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/vagrant/.pyenv/versions/3.10.2/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py:1080: in create_connection
    transport, protocol = await self._create_connection_transport(
/Users/vagrant/.pyenv/versions/3.10.2/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py:1110: in _create_connection_transport
    await waiter
/Users/vagrant/.pyenv/versions/3.10.2/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py:528: in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
/Users/vagrant/.pyenv/versions/3.10.2/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py:188: in feed_ssldata
    self._sslobj.do_handshake()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ssl.SSLObject object at 0x10cb08220>

    def do_handshake(self):
        """Start the SSL/TLS handshake."""
>       self._sslobj.do_handshake()
E       ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

/Users/vagrant/.pyenv/versions/3.10.2/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py:974: SSLCertVerificationError

The above exception was the direct cause of the following exception:

server = Server(host='localhost', port=9999)

    @pytest.mark.asyncio
    @pytest.mark.usefixtures("inject_truststore")
    async def test_aiohttp_works_with_inject(server: Server) -> None:
        async with ClientSession() as client:
>           resp = await client.get(server.base_url)

tests/test_inject.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../truststore-env/lib/python3.10/site-packages/aiohttp/client.py:663: in _request
    conn = await self._connector.connect(
../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:563: in connect
    proto = await self._create_connection(req, traces, timeout)
../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:1032: in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:1366: in _create_direct_connection
    raise last_exc
../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:1335: in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <aiohttp.connector.TCPConnector object at 0x10cb08dc0>, addr_infos = []
req = <aiohttp.client_reqrep.ClientRequest object at 0x10cb08460>
timeout = ClientTimeout(total=300, connect=None, sock_read=None, sock_connect=30, ceil_threshold=5)
client_error = <class 'aiohttp.client_exceptions.ClientConnectorError'>
args = (functools.partial(<class 'aiohttp.client_proto.ResponseHandler'>, loop=<_UnixSelectorEventLoop running=False closed=False debug=False>),)
kwargs = {'server_hostname': 'localhost', 'ssl': <ssl.SSLContext object at 0x10ad37b40>}
sock = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6>

    async def _wrap_create_connection(
        self,
        *args: Any,
        addr_infos: List[aiohappyeyeballs.AddrInfoType],
        req: ClientRequest,
        timeout: "ClientTimeout",
        client_error: Type[Exception] = ClientConnectorError,
        **kwargs: Any,
    ) -> Tuple[asyncio.Transport, ResponseHandler]:
        try:
            async with ceil_timeout(
                timeout.sock_connect, ceil_threshold=timeout.ceil_threshold
            ):
                sock = await aiohappyeyeballs.start_connection(
                    addr_infos=addr_infos,
                    local_addr_infos=self._local_addr_infos,
                    happy_eyeballs_delay=self._happy_eyeballs_delay,
                    interleave=self._interleave,
                    loop=self._loop,
                )
                return await self._loop.create_connection(*args, **kwargs, sock=sock)
        except cert_errors as exc:
>           raise ClientConnectorCertificateError(req.connection_key, exc) from exc
E           aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host localhost:9999 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]

../truststore-env/lib/python3.10/site-packages/aiohttp/connector.py:1100: ClientConnectorCertificateError
__________________________ test_check_hostname_false ___________________________

    @pytest.mark.internet
    def test_check_hostname_false():
        ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
        assert ctx.check_hostname is True
        assert ctx.verify_mode == ssl.CERT_REQUIRED
    
        with urllib3.PoolManager(ssl_context=ctx, retries=False) as http:
            with pytest.raises(SSLError) as e:
                http.request("GET", "https://wrong.host.badssl.com/")
>           assert "match" in str(e.value)
E           assert 'match' in "('Recoverable trust failure occurred',)"
E            +  where "('Recoverable trust failure occurred',)" = str(SSLError(SSLCertVerificationError('Recoverable trust failure occurred')))
E            +    where SSLError(SSLCertVerificationError('Recoverable trust failure occurred')) = <ExceptionInfo SSLError(SSLCertVerificationError('Recoverable trust failure occurred')) tblen=9>.value

tests/test_sslcontext.py:37: AssertionError
=========================== short test summary info ============================
SKIPPED [1] tests/test_api.py:287: urllib3 doesn't pass server_hostname for IP addresses
SKIPPED [1] tests/test_api.py:343: urllib3 doesn't pass server_hostname for IP addresses
=================== 4 failed, 58 passed, 2 skipped in 54.38s ===================
