-
Notifications
You must be signed in to change notification settings - Fork 108
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
Fix connect timeouts for anyio backend #236
Fix connect timeouts for anyio backend #236
Conversation
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.
Looking great! Left a comment to simplify things on the test setup side. 👍
e1587d1
to
4fe216e
Compare
@florimondmanca stream = await TLSStream.wrap(
stream,
hostname=unicode_host,
ssl_context=ssl_context,
standard_compatible=False,
) and that is expected by me. On other hand it means that all the work around fixtures was redundant. Should I remove all the |
@cdeler Yes, if just trying to connect via |
9ac15aa
to
d003888
Compare
d003888
to
87658d1
Compare
@florimondmanca I removed all unnecessary fixtures. But I still have to skip the test on 3.6 since testing against example.com behaves different |
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.
Great, thanks!
Why to add changes
In encode/httpx#1387 (comment) I found that
anyio
backend has problem with connection timeouts here:As
assert isinstance(TimeoutError(), OSError)
, the abovemap_exceptions
throwsConnectError
in case of any timeout (at least inawait TLSStream.wrap
)What has been done
I added 2 tests (
test_connection_timeout_tcp
andtest_connection_timeout_uds
) and fixed the errorNote
test_connection_timeout_uds
has been marked aspython >= 3.7
to reduce changeset footprint in theslow_uds_server
fixture (otherwise there should be a fallback Uvicorn server)