-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Improved Trio support #946
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
base: main
Are you sure you want to change the base?
Conversation
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we solve those? Why this doesn't happen on asyncio?
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.
Trio considers implicit async generator finalization a bad practice and emits a warning. Pytest turns this into an unraisable exception warning.
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.
The only way to fix this is to fix the problem in httpcore
.
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.
How would the fix in httpcore look like?
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.
Ah, this is not resource warning anyway, I'm okay with it. I read it wrongly.
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.
I don't know how to do that.
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.
I could just make a PR against httpcore
if you're willing to review it.
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.
I can review it.
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.
It looks like it needs changes in httpx
as well. I'll know the full picture once I have the tests passing locally.
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.
What changes are required?
websockets
doesn't support Trio yet__aenter__
and__aexit__
in some cases to exit the task group if there's a problem during initializationSimpleEventStore
where retrieving the stream ID was timing-dependenttyping-extensions
to dependencies, as the code already imported it unconditionallyMotivation 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