Skip to content

Commit

Permalink
fix: added async call to test client
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Hurst committed Mar 1, 2021
1 parent 34b07e6 commit 64a6afc
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions graphene/test/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -32,14 +31,10 @@ def format_result(self, result):

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)

0 comments on commit 64a6afc

Please sign in to comment.