| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
* Removed the asyncio-only parametrization of the anyio_backend except for test_ws, as `websockets` doesn't support Trio yet * Try to close async generators explicitly where possible * Changed nesting order for more predictable closing of async resources * Refactored `__aenter__` and `__aexit__` in some cases to exit the task group if there's a problem during initialization * Fixed test failures in client/test_auth.py where an async fixture was used in sync tests * Fixed subtle bug in `SimpleEventStore` where retrieving the stream ID was timing-dependent
| # This is to avoid test failures on Trio due to httpx's failure to explicitly close | ||
| # async generators | ||
| "ignore::pytest.PytestUnraisableExceptionWarning" |
There was a problem hiding this comment.
Can we solve those? Why this doesn't happen on asyncio?
Sorry, something went wrong.
There was a problem hiding this comment.
Trio considers implicit async generator finalization a bad practice and emits a warning. Pytest turns this into an unraisable exception warning.
Sorry, something went wrong.
There was a problem hiding this comment.
The only way to fix this is to fix the problem in httpcore.
Sorry, something went wrong.
There was a problem hiding this comment.
How would the fix in httpcore look like?
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, this is not resource warning anyway, I'm okay with it. I read it wrongly.
Sorry, something went wrong.
There was a problem hiding this comment.
The httpcore PR is ready, just waiting for review.
EDIT: the PR has been accepted, waiting for merge.
Sorry, something went wrong.
There was a problem hiding this comment.
The httpx PR: encode/httpx#3593
Sorry, something went wrong.
There was a problem hiding this comment.
Everything seems to fall into place now. With all my local changes applied, the test suite runs flawlessly on Trio.
Sorry, something went wrong.
There was a problem hiding this comment.
Great work!
Sorry, something went wrong.
There was a problem hiding this comment.
The httpx PR is now passing all tests with 100% coverage. Waiting for a review and merging.
Sorry, something went wrong.
…c library on the test server
There was a problem hiding this comment.
I found another issue in the test suite where I got a RuntimeError: Task got bad yield: <class 'trio._core._traps.CancelShieldedCheckpoint'>. This turned out to be caused by multiprocess forking the process for running a test server, where the sniffio contextvar was inherited from the parent. I fixed that by using spawning instead of forking.
The only things standing in the way of this passing are:
- tests: use inline_snapshot.Is on parametrized test #945
- a new httpx-sse release v0.4.1 has been released now
- getting Ensure that all async generators are explicitly closed encode/httpcore#1019 merged and a new release cut
- getting Ensured explicit closing of async generators encode/httpx#3593 merged and a new release cut
Hi both, thank you for working on this!
Just catching up here on the current state, looks like we're still waiting on these items to be able to land this PR?
Let me know if I can help with any of these!
Sorry, something went wrong.
There was a problem hiding this comment.
Marking this as "pending dependency changes" for now - looks like encode/httpx#3593 may have been closed while encode/httpcore#1019 is still pending?
Keen to support where needed to get this improvement landed! I've commented on encode/httpcore#1019 to see if there's anything else needed as it looks approved and able to merge?
Sorry, something went wrong.
httpcore is abandonware now that httpx 1.0 is under development. I don't expect to ever see another release of httpcore. |
Sorry, something went wrong.
Gotcha, thanks for the response! Looking at the discussion here https://github.com/anthropics/oss-collab/issues/60 it sounds like we'd need to update this repo to httpx 1.0 whenever it lands to be able to ship this change? That seems like it might require some bigger changes / refactors to the SDK, tentatively earmarking that for v2 for now as it seems like it would introduce some breaking changes potentially. |
Sorry, something went wrong.
|
Converting this to "Draft" for now as I believe we're blocked on the httpx 1.0 upgrade and to remove this one from the team's review queue while we await that. |
Sorry, something went wrong.
We are moving to httpx2, I've merged ur work in httpcore2. I'll update this when #2693 lands. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Motivation and Context
This was requested at https://github.com/anthropics/oss-collab/issues/60.
How Has This Been Tested?
No.
Breaking Changes
No.
Types of changes
Checklist
Additional context