Skip to content
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

Support core 3 2 #1417

Closed

Conversation

JonathanWylie
Copy link

Complete the fixes for: #1378

Cito and others added 2 commits September 30, 2021 10:51
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
- graphql-relay from_global_id no longer throws an exception if we fail to decode the id.
- So handle the case of it returning empty strings instead.
@mweinelt
Copy link

Still seeing one of the issue mentioned over there.

___________________________ 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
Copy link
Author

@mweinelt That test seems to pass OK.

$ py.test -v graphene/utils/tests
============================================================================================================================================= test session starts ==============================================================================================================================================
platform linux -- Python 3.8.0, pytest-5.4.3, py-1.11.0, pluggy-0.13.1 -- /home/jonny/workspace/graphql/graphene/venv/bin/python3.8
cachedir: .pytest_cache
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/jonny/workspace/graphql/graphene, inifile: tox.ini
plugins: benchmark-3.4.1, asyncio-0.16.0, snapshottest-0.6.0, mock-2.0.0, cov-2.12.1
collected 40 items                                                                                                                                                                                                                                                                                             

graphene/utils/tests/test_crunch.py::test_crunch[number primitive-0-crunched0] PASSED                                                                                                                                                                                                                    [  2%]
graphene/utils/tests/test_crunch.py::test_crunch[boolean primitive-True-crunched1] PASSED                                                                                                                                                                                                                [  5%]
graphene/utils/tests/test_crunch.py::test_crunch[string primitive-string-crunched2] PASSED                                                                                                                                                                                                               [  7%]
graphene/utils/tests/test_crunch.py::test_crunch[empty array-uncrunched3-crunched3] PASSED                                                                                                                                                                                                               [ 10%]
graphene/utils/tests/test_crunch.py::test_crunch[single-item array-uncrunched4-crunched4] PASSED                                                                                                                                                                                                         [ 12%]
graphene/utils/tests/test_crunch.py::test_crunch[multi-primitive all distinct array-uncrunched5-crunched5] PASSED                                                                                                                                                                                        [ 15%]
graphene/utils/tests/test_crunch.py::test_crunch[multi-primitive repeated array-uncrunched6-crunched6] PASSED                                                                                                                                                                                            [ 17%]
graphene/utils/tests/test_crunch.py::test_crunch[one-level nested array-uncrunched7-crunched7] PASSED                                                                                                                                                                                                    [ 20%]
graphene/utils/tests/test_crunch.py::test_crunch[two-level nested array-uncrunched8-crunched8] PASSED                                                                                                                                                                                                    [ 22%]
graphene/utils/tests/test_crunch.py::test_crunch[empty object-uncrunched9-crunched9] PASSED                                                                                                                                                                                                              [ 25%]
graphene/utils/tests/test_crunch.py::test_crunch[single-item object-uncrunched10-crunched10] PASSED                                                                                                                                                                                                      [ 27%]
graphene/utils/tests/test_crunch.py::test_crunch[multi-item all distinct object-uncrunched11-crunched11] PASSED                                                                                                                                                                                          [ 30%]
graphene/utils/tests/test_crunch.py::test_crunch[multi-item repeated object-uncrunched12-crunched12] PASSED                                                                                                                                                                                              [ 32%]
graphene/utils/tests/test_crunch.py::test_crunch[complex array-uncrunched13-crunched13] PASSED                                                                                                                                                                                                           [ 35%]
graphene/utils/tests/test_crunch.py::test_crunch[complex object-uncrunched14-crunched14] PASSED                                                                                                                                                                                                          [ 37%]
graphene/utils/tests/test_deduplicator.py::test_does_not_modify_object_without_typename_and_id PASSED                                                                                                                                                                                                    [ 40%]
graphene/utils/tests/test_deduplicator.py::test_does_not_modify_first_instance_of_an_object PASSED                                                                                                                                                                                                       [ 42%]
graphene/utils/tests/test_deduplicator.py::test_does_not_modify_first_instance_of_an_object_nested PASSED                                                                                                                                                                                                [ 45%]
graphene/utils/tests/test_deduplicator.py::test_does_not_modify_input PASSED                                                                                                                                                                                                                             [ 47%]
graphene/utils/tests/test_deduplicator.py::test_example_end_to_end PASSED                                                                                                                                                                                                                                [ 50%]
graphene/utils/tests/test_deprecated.py::test_warn_deprecation PASSED                                                                                                                                                                                                                                    [ 52%]
graphene/utils/tests/test_deprecated.py::test_deprecated_decorator PASSED                                                                                                                                                                                                                                [ 55%]
graphene/utils/tests/test_deprecated.py::test_deprecated_class PASSED                                                                                                                                                                                                                                    [ 57%]
graphene/utils/tests/test_deprecated.py::test_deprecated_decorator_text PASSED                                                                                                                                                                                                                           [ 60%]
graphene/utils/tests/test_deprecated.py::test_deprecated_class_text PASSED                                                                                                                                                                                                                               [ 62%]
graphene/utils/tests/test_deprecated.py::test_deprecated_other_object PASSED                                                                                                                                                                                                                             [ 65%]
graphene/utils/tests/test_module_loading.py::test_import_string PASSED                                                                                                                                                                                                                                   [ 67%]
graphene/utils/tests/test_module_loading.py::test_import_string_module PASSED                                                                                                                                                                                                                            [ 70%]
graphene/utils/tests/test_module_loading.py::test_import_string_class PASSED                                                                                                                                                                                                                             [ 72%]
graphene/utils/tests/test_module_loading.py::test_import_string_attributes PASSED                                                                                                                                                                                                                        [ 75%]
graphene/utils/tests/test_module_loading.py::test_lazy_import PASSED                                                                                                                                                                                                                                     [ 77%]
graphene/utils/tests/test_orderedtype.py::test_orderedtype PASSED                                                                                                                                                                                                                                        [ 80%]
graphene/utils/tests/test_orderedtype.py::test_orderedtype_eq PASSED                                                                                                                                                                                                                                     [ 82%]
graphene/utils/tests/test_orderedtype.py::test_orderedtype_hash PASSED                                                                                                                                                                                                                                   [ 85%]
graphene/utils/tests/test_orderedtype.py::test_orderedtype_resetcounter PASSED                                                                                                                                                                                                                           [ 87%]
graphene/utils/tests/test_orderedtype.py::test_orderedtype_non_orderabletypes PASSED                                                                                                                                                                                                                     [ 90%]
graphene/utils/tests/test_resolve_only_args.py::test_resolve_only_args PASSED                                                                                                                                                                                                                            [ 92%]
graphene/utils/tests/test_str_converters.py::test_snake_case PASSED                                                                                                                                                                                                                                      [ 95%]
graphene/utils/tests/test_str_converters.py::test_camel_case PASSED                                                                                                                                                                                                                                      [ 97%]
graphene/utils/tests/test_trim_docstring.py::test_trim_docstring PASSED                                                                                                                                                                                                                                  [100%]

============================================================================================================================================== 40 passed in 0.27s ==============================================================================================================================================

@JonathanWylie
Copy link
Author

@mweinelt can you tell me how to recreate that test failure? Because it isn't failing for me.

@mweinelt
Copy link

That's a good question. We're running with

  • graphql-core 3.2.0
  • graphql-relay 3.2.0
  • aniso8601 9.0.1

And for the tests:

  • promise 2.3.0
  • pytest-asyncio 0.18.3
  • pytest-benchmark 3.4.1
  • pytest-mock 3.7.0
  • pytest 7.1.1
  • pytz 2022.1
  • snapshottest 0.6.0

@ddelange
Copy link

@JonathanWylie could you add Fixes #1406 to the PR description so that github closes that issue once this PR merges?

@ddelange
Copy link

Or is this PR superseded by #1421 @Cito?

@Cito
Copy link
Member

Cito commented May 25, 2022

Or is this PR superseded by #1421

@ddelange Yes, I think this is all already included there.

Thanks @JonathanWylie for this PR - I had not noticed that you already fixed this, as I'm not watching Graphene very closely.

So I am closing this now. If there are still any issue with Core 3.2, let me know and I will take care.

@Cito Cito closed this May 25, 2022
@JonathanWylie JonathanWylie deleted the support-core-3-2 branch May 26, 2022 09:25
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.

4 participants