diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5d2973ce..f124e60a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"] + python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10-dev"] steps: - uses: actions/checkout@v2 diff --git a/graphene/relay/connection.py b/graphene/relay/connection.py index 047f2b4d..c05160b5 100644 --- a/graphene/relay/connection.py +++ b/graphene/relay/connection.py @@ -1,5 +1,11 @@ import re -from collections import Iterable, OrderedDict +from collections import OrderedDict + +try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable + from functools import partial from graphql_relay import connection_from_list diff --git a/graphene/types/field.py b/graphene/types/field.py index 7f63a853..39db65e9 100644 --- a/graphene/types/field.py +++ b/graphene/types/field.py @@ -1,5 +1,11 @@ import inspect -from collections import Mapping, OrderedDict +from collections import OrderedDict + +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + from functools import partial from .argument import Argument, to_arguments diff --git a/graphene/utils/crunch.py b/graphene/utils/crunch.py index 57fcb77f..a84a0d31 100644 --- a/graphene/utils/crunch.py +++ b/graphene/utils/crunch.py @@ -1,5 +1,9 @@ import json -from collections import Mapping + +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping def to_key(value): diff --git a/graphene/utils/deduplicator.py b/graphene/utils/deduplicator.py index 13c1cb16..57980772 100644 --- a/graphene/utils/deduplicator.py +++ b/graphene/utils/deduplicator.py @@ -1,4 +1,9 @@ -from collections import Mapping, OrderedDict +from collections import OrderedDict + +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping def deflate(node, index=None, path=None): diff --git a/tox.ini b/tox.ini index 4e1cc9dc..5a555042 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,36,37,38,39},flake8,pre-commit,mypy +envlist = py{27,36,37,38,39,310},flake8,pre-commit,mypy [gh-actions] python = @@ -8,18 +8,19 @@ python = 3.7: py37 3.8: py38 3.9: py39 + 3.10-dev: py310 [testenv] passenv = * usedevelop = True deps = -e.[test] - py{36,37,38,39}: pytest-asyncio + py{36,37,38,39,310}: pytest-asyncio setenv = PYTHONPATH = .:{envdir} commands = py{27}: py.test --cov=graphene graphene examples {posargs} - py{36,37,38,39}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs} + py{36,37,38,39,310}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs} [testenv:pre-commit] deps =