Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions graphene/test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from promise import Promise, is_thenable
from graphql.error import format_error as format_graphql_error
from graphql.error import GraphQLError

from graphene.types.schema import Schema
Expand Down Expand Up @@ -31,7 +31,10 @@ def format_result(self, result):

def execute(self, *args, **kwargs):
executed = self.schema.execute(*args, **dict(self.execute_options, **kwargs))
if is_thenable(executed):
return Promise.resolve(executed).then(self.format_result)

return self.format_result(executed)

async def execute_async(self, *args, **kwargs):
executed = await self.schema.execute_async(*args, **dict(self.execute_options, **kwargs))

return self.format_result(executed)