New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compatibility for httpx
-based TestClient
for latest FastAPI version
#1460
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1460 +/- ##
==========================================
- Coverage 91.45% 91.43% -0.03%
==========================================
Files 74 74
Lines 4399 4411 +12
==========================================
+ Hits 4023 4033 +10
- Misses 376 378 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.86.0 to 0.88.0. - [Release notes](https://github.com/tiangolo/fastapi/releases) - [Commits](tiangolo/fastapi@0.86.0...0.88.0) --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
39f6291
to
c244123
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the review @JPBergsma! |
This PR updates tests, validator and client usage of requests/httpx to add compatibility for the new
httpx
-basedTestClient
required by the latest FastAPI version (whilst also maintaining compatibility with older versions).To do this, I had to:
pytest-httpx
as it caused infinite recursion between the mocked test client and the mocked requests themselves, with no clean workaroundhttpx.URL
now used within the test clientOptimadeClient
, so a patched test client can be specified directlyhttpx
andrequests
We can probably now begin the process of using httpx in the validator too, though a naive switch out lead to some errors that I don't want to fix in this PR.