Migrate tests to aiointercept and use aiohttp.encode_basic_auth - #538
Open
balloobbot wants to merge 2 commits into
Open
Migrate tests to aiointercept and use aiohttp.encode_basic_auth#538balloobbot wants to merge 2 commits into
balloobbot wants to merge 2 commits into
Conversation
aiohttp.BasicAuth and the request `auth` parameter are deprecated and will be removed in aiohttp 4.0.
Collaborator
|
We should drop aioresponses and switch to aiointercept instead |
aioresponses cannot mock aiohttp 3.14, which is what pinned the test suite below it. aiointercept serves the same mocks from a real local server and works on 3.14, so the aiohttp floor moves to 3.14 and the hand-rolled Authorization header becomes aiohttp.encode_basic_auth(). Connection-layer failures aiointercept cannot emit (ClientResponseError, ClientConnectorSSLError) are now injected by patching the session.
Contributor
|
Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
aiohttp.BasicAuthand the requestauthparameter are deprecated and will be removed in aiohttp 4.0. Their replacement,aiohttp.encode_basic_auth(), landed in aiohttp 3.14.0, so the aiohttp floor moves to 3.14 and this migration becomes a non-event.Reaching 3.14 first meant replacing aioresponses, which is why
requirements-test.txtstill cappedaiohttp<3.14(pnuckowski/aioresponses#288 is still unreleased). aiointercept is a near drop-in replacement that serves the same mocks from a real local aiohttp server and supports 3.14, so the cap is gone.Two test-side notes:
ClientConnectionError, so the tests that inject aClientResponseErroror aClientConnectorSSLErrornow patch the session instead of the mock. They cover the same branches.conftest.pygains an autouse fixture routing them through aiohttp's resolver.All 448 tests pass on aiohttp 3.14.3.
I'm a bot, asked by @balloob to fix this because the deprecation warning shows up in Home Assistant CI.