Skip to content

Commit

Permalink
Support Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Nov 2, 2022
1 parent 4c8ecd4 commit ef0ac89
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10

- name: Build wheel and source tarball
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', 'pypy3.9']
python: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy3.9']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
version: 2

build:
os: ubuntu-20.04
os: ubuntu-22.04
tools:
python: "3.9"
python: "3.10"

sphinx:
configuration: docs/conf.py
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
EnterLeaveVisitor
FormattedSourceLocation
GraphQLAbstractType
GraphQLErrorExtensions
GraphQLOutputType
asyncio.events.AbstractEventLoop
graphql.execution.map_async_iterator.MapAsyncIterator
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ classifiers = [
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10"
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
packages = [
{ include = "graphql", from = "src" },
Expand Down Expand Up @@ -80,7 +81,7 @@ sphinx_rtd_theme = ">=1,<2"
exclude_dirs = ["tests"]

[tool.black]
target-version = ["py37", "py38", "py39", "py310"]
target-version = ["py37", "py38", "py39", "py310", "py311"]

[tool.coverage.run]
branch = true
Expand Down Expand Up @@ -119,7 +120,7 @@ force_single_line = false
lines_after_imports = 2

[tool.mypy]
python_version = 3.9
python_version = "3.10"
check_untyped_defs = true
no_implicit_optional = true
strict_optional = true
Expand Down
3 changes: 3 additions & 0 deletions tests/execution/test_nonnull.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import re
from typing import Any, Awaitable, cast

Expand Down Expand Up @@ -482,6 +483,7 @@ def describe_nulls_the_top_level_if_non_nullable_field():
@mark.asyncio
async def returns_null():
result = await execute_sync_and_async(query, NullingData())
await asyncio.sleep(0) # strangely needed to get coverage on Python 3.11
assert result == (
None,
[
Expand All @@ -497,6 +499,7 @@ async def returns_null():
@mark.asyncio
async def throws():
result = await execute_sync_and_async(query, ThrowingData())
await asyncio.sleep(0) # strangely needed to get coverage on Python 3.11
assert result == (
None,
[
Expand Down
9 changes: 7 additions & 2 deletions tests/pyutils/test_is_awaitable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
from inspect import isawaitable
from sys import version_info as python_version

from pytest import mark

Expand Down Expand Up @@ -75,8 +76,12 @@ async def some_coroutine():
assert isawaitable(some_coroutine())
assert is_awaitable(some_coroutine())

@mark.filterwarnings("ignore::Warning") # Deprecation and Runtime
def recognizes_an_old_style_coroutine():
@mark.filterwarnings("ignore::Warning") # Deprecation and Runtime warnings
@mark.skipif(
python_version >= (3, 11),
reason="Generator-based coroutines not supported any more since Python 3.11",
)
def recognizes_an_old_style_coroutine(): # pragma: no cover
@asyncio.coroutine
def some_old_style_coroutine():
yield False # pragma: no cover
Expand Down
15 changes: 8 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py3{7,8,9,10}, pypy39, black, flake8, isort, mypy, docs
envlist = py3{7,8,9,10,11}, pypy39, black, flake8, isort, mypy, docs
isolated_build = true

[gh-actions]
Expand All @@ -8,18 +8,19 @@ python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.10: py310<g
3.11: py311
pypy3: pypy39
pypy3.9: pypy39

[testenv:black]
basepython = python3.9
basepython = python3.10
deps = black==22.10.0
commands =
black src tests -t py39 --check

[testenv:flake8]
basepython = python3.9
basepython = python3.10
deps =
flake8>=5,<6
flake8-bandit>=4.1,<6
Expand All @@ -28,21 +29,21 @@ commands =
flake8 src tests

[testenv:isort]
basepython = python3.9
basepython = python3.10
deps = isort>=5.10,<6
commands =
isort src tests --check-only

[testenv:mypy]
basepython = python3.9
basepython = python3.10
deps =
mypy==0.982
pytest>=7.1,<8
commands =
mypy src tests

[testenv:docs]
basepython = python3.9
basepython = python3.10
deps =
sphinx>=5.2.1,<6
sphinx_rtd_theme>=1,<2
Expand Down

0 comments on commit ef0ac89

Please sign in to comment.