mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 13:59:51 +03:00
fix: added async call to test client
This commit is contained in:
parent
34b07e6209
commit
64a6afc92e
|
@ -1,6 +1,5 @@
|
|||
from graphql.error import format_error as format_graphql_error
|
||||
from graphql.error import GraphQLError
|
||||
from graphql.pyutils import is_awaitable
|
||||
|
||||
from graphene.types.schema import Schema
|
||||
|
||||
|
@ -32,14 +31,10 @@ class Client:
|
|||
|
||||
def execute(self, *args, **kwargs):
|
||||
executed = self.schema.execute(*args, **dict(self.execute_options, **kwargs))
|
||||
if is_awaitable(executed):
|
||||
executed = asyncio.run(executed)
|
||||
|
||||
return self.format_result(executed)
|
||||
|
||||
async def execute_async(self, *args, **kwargs):
|
||||
executed = self.schema.execute(*args, **dict(self.execute_options, **kwargs))
|
||||
if is_awaitable(executed):
|
||||
executed = await executed
|
||||
executed = await self.schema.execute_async(*args, **dict(self.execute_options, **kwargs))
|
||||
|
||||
return self.format_result(executed)
|
||||
|
|
Loading…
Reference in New Issue
Block a user