diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f50d586b..29664948 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,6 +45,9 @@ jobs: django-version: - 4.2.* - 5.0.* + graphql-core-version: + - 3.3.0a5 + - 3.2.3 python-version: - '3.8' - '3.9' @@ -80,6 +83,8 @@ jobs: run: poetry install - name: Install Django ${{ matrix.django-version }} run: poetry run pip install "django==${{ matrix.django-version }}" + - name: Install graphql-core ${{ matrix.graphql-core-version }} + run: poetry run pip install "graphql-core==${{ matrix.graphql-core-version }}" - name: Test with pytest run: poetry run pytest --showlocals -vvv --cov-report=xml - name: Upload coverage to Codecov diff --git a/poetry.lock b/poetry.lock index 44de8b9f..e190021c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "asgiref" diff --git a/strawberry_django/optimizer.py b/strawberry_django/optimizer.py index 9845bae9..a34a47b9 100644 --- a/strawberry_django/optimizer.py +++ b/strawberry_django/optimizer.py @@ -35,7 +35,12 @@ GraphQLWrappingType, get_argument_values, ) -from graphql.execution.collect_fields import collect_sub_fields + +try: + from graphql.execution.collect_fields import collect_sub_fields +except ImportError: + from graphql.execution.collect_fields import collect_subfields as collect_sub_fields + from graphql.language.ast import OperationType from graphql.type.definition import GraphQLResolveInfo, get_named_type from strawberry import relay