diff --git a/graphene/relay/tests/test_mutation_async.py b/graphene/relay/tests/test_mutation_async.py index 4308a6141..bf61555de 100644 --- a/graphene/relay/tests/test_mutation_async.py +++ b/graphene/relay/tests/test_mutation_async.py @@ -3,6 +3,7 @@ from graphene.types import ID, Field, ObjectType, Schema from graphene.types.scalars import String from graphene.relay.mutation import ClientIDMutation +from graphene.test import Client class SharedFields(object): @@ -61,24 +62,27 @@ class Mutation(ObjectType): schema = Schema(query=RootQuery, mutation=Mutation) +client = Client(schema) @mark.asyncio async def test_node_query_promise(): - executed = await schema.execute_async( + executed = await client.execute_async( 'mutation a { sayPromise(input: {what:"hello", clientMutationId:"1"}) { phrase } }' ) - assert not executed.errors - assert executed.data == {"sayPromise": {"phrase": "hello"}} + assert isinstance(executed, dict) + assert "errors" not in executed + assert executed["data"] == {"sayPromise": {"phrase": "hello"}} @mark.asyncio async def test_edge_query(): - executed = await schema.execute_async( + executed = await client.execute_async( 'mutation a { other(input: {clientMutationId:"1"}) { clientMutationId, myNodeEdge { cursor node { name }} } }' ) - assert not executed.errors - assert dict(executed.data) == { + assert isinstance(executed, dict) + assert "errors" not in executed + assert executed["data"] == { "other": { "clientMutationId": "1", "myNodeEdge": {"cursor": "1", "node": {"name": "name"}}, diff --git a/graphene/test/__init__.py b/graphene/test/__init__.py index 13b05dd3b..1813d9284 100644 --- a/graphene/test/__init__.py +++ b/graphene/test/__init__.py @@ -1,4 +1,3 @@ -from promise import Promise, is_thenable from graphql.error import GraphQLError from graphene.types.schema import Schema @@ -31,7 +30,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) diff --git a/setup.py b/setup.py index dce6aa6c0..6c1f29c95 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ def run_tests(self): "pytest-asyncio>=0.16,<2", "snapshottest>=0.6,<1", "coveralls>=3.3,<4", - "promise>=2.3,<3", "mock>=4,<5", "pytz==2022.1", "iso8601>=1,<2",