You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is 50% a bug and 50% a missing feature 😅 In #154 there was an ask for the HTTPX transport which support Trio. It was completed in #370 but if trying to actually use with AnyIO with the trio backend, there's an exception due to the use of asyncio.timeout: RuntimeError: no running event loop caused by gql/client.py:1535 (
Use gql 3.5.0b8, along with httpx, anyio[trio], and setup pytest to run the test with anyio backends (asyncio and trio by default). Use pytest-httpx to mock out actual HTTP calls though not strictly necessary
Setup the transport: transport = HTTPXAsyncTransport(url=<any_url>)
Setup the client: client = Client(transport=transport, fetch_schema_from_transport=False, execute_timeout=10)
Setup a test using the httpx_mock fixture, e.g. httpx_mock.add_response(url=<same url as client>, method="POST", json={"data": {}})
Do the actual request: await client.execute_async(query, variable_values=variable_values) (query and variable_values can be anything, it doesn't matter at this point)
Expected behavior
I would expect that if I'm using httpx transport, that the AsyncClient would be using AnyIO for timeouts working with any backends supported by httpx. Alternatively, the async client should not be handling timeouts on its own and that should be up to the transport (httpx can handle the timeout, for instance). The end result would still be that I could run gql in trio using the httpx transport without any issues
System info (please complete the following information):
OS: macos 14.2
Python version: 3.12.1
gql version: 3.5.0b8
graphql-core version: 3.3.0a3
The text was updated successfully, but these errors were encountered:
Describe the bug
This is 50% a bug and 50% a missing feature 😅 In #154 there was an ask for the HTTPX transport which support Trio. It was completed in #370 but if trying to actually use with AnyIO with the trio backend, there's an exception due to the use of asyncio.timeout:
RuntimeError: no running event loop
caused bygql/client.py:1535
(gql/gql/client.py
Line 1535 in a2f327f
To Reproduce
Steps to reproduce the behavior:
transport = HTTPXAsyncTransport(url=<any_url>)
client = Client(transport=transport, fetch_schema_from_transport=False, execute_timeout=10)
httpx_mock
fixture, e.g.httpx_mock.add_response(url=<same url as client>, method="POST", json={"data": {}})
await client.execute_async(query, variable_values=variable_values)
(query and variable_values can be anything, it doesn't matter at this point)Expected behavior
I would expect that if I'm using httpx transport, that the AsyncClient would be using AnyIO for timeouts working with any backends supported by httpx. Alternatively, the async client should not be handling timeouts on its own and that should be up to the transport (httpx can handle the timeout, for instance). The end result would still be that I could run gql in trio using the httpx transport without any issues
System info (please complete the following information):
The text was updated successfully, but these errors were encountered: