Skip to content

Fix typo in ConnectionPool and AsyncConnectionPool#908

Merged
karpetrosyan merged 2 commits intoencode:masterfrom
n-thumann:fix_typo_connection_pool
May 17, 2024
Merged

Fix typo in ConnectionPool and AsyncConnectionPool#908
karpetrosyan merged 2 commits intoencode:masterfrom
n-thumann:fix_typo_connection_pool

Conversation

@n-thumann
Copy link
Contributor

Summary

This PR fixes a typo in the ConnectionPool and AsyncConnectionPool classes.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@lovelydinosaur
Copy link
Contributor

Oh great, thanks.
And you've nudged a flaky test as well.
I wonder what that's about?

@lovelydinosaur
Copy link
Contributor

Bumped into a flaky test...

______________ test_connection_pool_timeout_during_request[trio] _______________

    @pytest.mark.anyio
    async def test_connection_pool_timeout_during_request():
        """
        An async timeout when writing an HTTP/1.1 response on the connection pool
        should leave the pool in a consistent state.
    
        In this case, that means the connection will become closed, and no
        longer remain in the pool.
        """
        network_backend = SlowWriteBackend()
        async with httpcore.AsyncConnectionPool(network_backend=network_backend) as pool:
            with anyio.move_on_after(0.01):
                await pool.request("GET", "http://example.com/")
>           assert not pool.connections
E           AssertionError: assert not [<AsyncHTTPConnection ['[http://example.com:80](http://example.com/)', HTTP/1.1, NEW, Request Count: 0]>]
E            +  where [<AsyncHTTPConnection ['[http://example.com:80](http://example.com/)', HTTP/1.1, NEW, Request Count: 0]>] = <AsyncConnectionPool [Requests: 0 active, 0 queued | Connections: 1 active, 0 idle]>.connections

tests/test_cancellations.py:111: AssertionError

@karpetrosyan karpetrosyan merged commit c96fdf7 into encode:master May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants