예제 #1
0
    async def test_not_modified_releases_connection(self, url):
        async_client = AsyncClient(
            timeout=Timeout(1, pool=0.1),
            limits=Limits(max_connections=1, max_keepalive_connections=1),
        )
        async_client._transport = AsyncCachingTransport(
            transport=async_client._transport, )

        # make sure the pool doesn't time out
        for _i in range(3):
            await async_client.get(url + "etag")

        await async_client.aclose()
예제 #2
0
async def async_client(mocker):
    async_client = AsyncClient()
    transport = AsyncCachingTransport(
        transport=async_client._transport,
        cache=AsyncDictCache(),
    )
    async_client._transport = transport

    mocker.patch.object(transport.transport,
                        "arequest",
                        wraps=transport.transport.arequest)

    yield async_client

    await async_client.aclose()