Skip to content

Make tests work with GraphQL-core 3.2.0rc2 #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Cito
Copy link
Member

@Cito Cito commented Sep 30, 2021

This fix aligns to some changes in GraphQL-core 3.2 which reflect changes in GraphQL.js 16:

  • type resolvers must return only names
  • doesn't print trailing newlines any more
  • different wording of some error messages

This fix aligns to some changes in GraphQL-core 3.2
which reflect changes in GraphQL.js 16:
- type resolvers must return only names
- doesn't print trailing newlines any more
- different wording of some error messages
@ddelange
Copy link

ddelange commented Apr 4, 2022

Closes #1406 ? Our CI caught another faulty import with 3.2 btw: https://github.com/graphql-python/graphene/pull/1415/files

@mweinelt
Copy link

In addition to the remaining issue already referenced we see

_________________________ test_node_query_incorrect_id _________________________

    def test_node_query_incorrect_id():
        executed = schema.execute(
            '{ node(id:"%s") { ... on MyNode { name } } }' % "something:2"
        )
        assert executed.errors
>       assert re.match(r"Unable to parse global ID .*", executed.errors[0].message)
E       assert None
E        +  where None = <function match at 0x7ffff75181f0>('Unable to parse global ID .*', 'Relay Node "" not found in schema')
E        +    where <function match at 0x7ffff75181f0> = re.match
E        +    and   'Relay Node "" not found in schema' = GraphQLError('Relay Node "" not found in schema', locations=[SourceLocation(line=1, column=3)], path=['node']).message

graphene/relay/tests/test_node.py:109: AssertionError
___________________________ test_example_end_to_end ____________________________

    def test_example_end_to_end():
        class Movie(graphene.ObjectType):
            class Meta:
                interfaces = (relay.Node,)
                default_resolver = dict_resolver

            name = graphene.String(required=True)
            synopsis = graphene.String(required=True)

        class Event(graphene.ObjectType):
            class Meta:
                interfaces = (relay.Node,)
                default_resolver = dict_resolver

            movie = graphene.Field(Movie, required=True)
            date = graphene.types.datetime.Date(required=True)

            def resolve_movie(event, info):
                return TEST_DATA["movies"][event["movie"]]

        class Query(graphene.ObjectType):
            events = graphene.List(graphene.NonNull(Event), required=True)

            def resolve_events(_, info):
                return TEST_DATA["events"]

        schema = graphene.Schema(query=Query)
        query = """\
            {
                events {
                    __typename
                    id
                    date
                    movie {
                        __typename
                        id
                        name
                        synopsis
                    }
                }
            }
        """
        result = schema.execute(query)
>       assert not result.errors
E       AssertionError: assert not [GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])]
E        +  where [GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])] = ExecutionResult(data=None, errors=[GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])]).errors

graphene/utils/tests/test_deduplicator.py:151: AssertionError

@JonathanWylie JonathanWylie mentioned this pull request Apr 19, 2022
@JonathanWylie
Copy link

I made a pull request built on top of this pull request, hopefully fixing the remaining issues: #1417

@SuperSandro2000
Copy link

This can be closed with the 3.1.0 release.

@ddelange
Copy link

ddelange commented Jun 2, 2022

yes, superceded by #1421

@erikwrede
Copy link
Member

@ddelange @SuperSandro2000 thank you for linking the other issue!

@erikwrede erikwrede closed this Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants