test: build mock httpware clients with transport= instead of a borrowed httpx2 client - #86
Merged
Merged
Conversation
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.
Problem
The provider tests built an
httpx2.Clientby hand only to inject aMockTransport, then wrapped it withhttpware.Client(httpx2_client=...). httpware does not close a client passed in that way, so_make_providerin both provider test modules returned the inner httpx2 client separately for teardown, with a comment explaining the workaround.tests/conftest.pyneeded two fixtures for one client.Change
httpware 0.18.0 forwards every httpx2 client option, so the mocks pass
transport=straight tohttpware.Client. httpware then owns the httpx2 client and closes it along with itself._make_provider(GitLab and GitHub) returns the httpware client. Call sites keepwith client:unchanged, and the workaround comment is gone.tests/conftest.py:gitlab_clientandgitlab_httpmerge into a singlegitlab_httpfixture.tests/integration/conftest.py:install_mock_transportbuilds the client in one call.tests/integration/README.md: describes the new construction.pyproject.toml: the httpware floor goes from 0.15.0 to 0.18.0, because the tests needtransport=and the declared floor is what they run against.The runtime code in
semvertag/ioc.pyis unchanged.Verification
ruff, ty and the full suite pass locally (473 passed, 100% coverage) against httpware 0.18.0.