Add Python 3.9 and 3.10 to the test matrix

Also update the test dependencies and adapt two tests (#1400).
This commit is contained in:
Christoph Zwerschke 2022-01-11 12:13:12 +01:00
parent 7ecb4e68ba
commit e441fa72aa
No known key found for this signature in database
GPG Key ID: 04E06042706EE52E
7 changed files with 40 additions and 42 deletions

View File

@ -11,10 +11,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Set up Python 3.9
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.9
- name: Build wheel and source tarball - name: Build wheel and source tarball
run: | run: |
pip install wheel pip install wheel

View File

@ -8,10 +8,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Set up Python 3.9
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.9
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip

View File

@ -25,6 +25,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38} - {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37} - {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36} - {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}

View File

@ -1,9 +1,9 @@
default_language_version: default_language_version:
python: python3.8 python: python3.9
repos: repos:
- repo: git://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0 rev: v4.1.0
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
- id: check-json - id: check-json
@ -16,15 +16,15 @@ repos:
- --autofix - --autofix
- id: trailing-whitespace - id: trailing-whitespace
exclude: README.md exclude: README.md
- repo: git://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.24.0 rev: v2.31.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
- repo: git://github.com/ambv/black - repo: https://github.com/ambv/black
rev: 19.3b0 rev: 21.12b0
hooks: hooks:
- id: black - id: black
- repo: git://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.8.4 rev: 4.0.1
hooks: hooks:
- id: flake8 - id: flake8

View File

@ -191,21 +191,15 @@ def test_objecttype_as_container_all_kwargs():
def test_objecttype_as_container_extra_args(): def test_objecttype_as_container_extra_args():
with raises(TypeError) as excinfo: msg = r"__init__\(\) takes from 1 to 3 positional arguments but 4 were given"
Container("1", "2", "3") with raises(TypeError, match=msg):
Container("1", "2", "3") # type: ignore
assert "__init__() takes from 1 to 3 positional arguments but 4 were given" == str(
excinfo.value
)
def test_objecttype_as_container_invalid_kwargs(): def test_objecttype_as_container_invalid_kwargs():
with raises(TypeError) as excinfo: msg = r"__init__\(\) got an unexpected keyword argument 'unexisting_field'"
Container(unexisting_field="3") with raises(TypeError, match=msg):
Container(unexisting_field="3") # type: ignore
assert "__init__() got an unexpected keyword argument 'unexisting_field'" == str(
excinfo.value
)
def test_objecttype_container_benchmark(benchmark): def test_objecttype_container_benchmark(benchmark):

View File

@ -45,17 +45,17 @@ class PyTest(TestCommand):
tests_require = [ tests_require = [
"pytest>=5.3,<6", "pytest>=6,<7",
"pytest-benchmark>=3.2,<4", "pytest-benchmark>=3.4,<4",
"pytest-cov>=2.8,<3", "pytest-cov>=3,<4",
"pytest-mock>=2,<3", "pytest-mock>=3,<4",
"pytest-asyncio>=0.10,<2", "pytest-asyncio>=0.16,<2",
"snapshottest>=0.5,<1", "snapshottest>=0.6,<1",
"coveralls>=1.11,<2", "coveralls>=3.3,<4",
"promise>=2.3,<3", "promise>=2.3,<3",
"mock>=4.0,<5", "mock>=4.0,<5",
"pytz==2021.1", "pytz==2021.3",
"iso8601>=0.1,<2", "iso8601>=1,<2",
] ]
dev_requires = ["black==19.10b0", "flake8>=3.7,<4"] + tests_require dev_requires = ["black==19.10b0", "flake8>=3.7,<4"] + tests_require
@ -78,6 +78,8 @@ setup(
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
], ],
keywords="api graphql protocol rest relay graphene", keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["examples*"]), packages=find_packages(exclude=["examples*"]),

16
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = flake8,py36,py37,py38,pre-commit,mypy envlist = py3{6,7,8,9,10}, flake8, mypy, pre-commit
skipsdist = true skipsdist = true
[testenv] [testenv]
@ -8,28 +8,28 @@ deps =
setenv = setenv =
PYTHONPATH = .:{envdir} PYTHONPATH = .:{envdir}
commands = commands =
py{36,37,38}: pytest --cov=graphene graphene examples {posargs} py{36,37,38,39,310}: pytest --cov=graphene graphene examples {posargs}
[testenv:pre-commit] [testenv:pre-commit]
basepython=python3.8 basepython = python3.9
deps = deps =
pre-commit>=2,<3 pre-commit>=2.16,<3
setenv = setenv =
LC_CTYPE=en_US.UTF-8 LC_CTYPE=en_US.UTF-8
commands = commands =
pre-commit run --all-files --show-diff-on-failure pre-commit run --all-files --show-diff-on-failure
[testenv:mypy] [testenv:mypy]
basepython=python3.8 basepython = python3.9
deps = deps =
mypy>=0.761,<1 mypy>=0.931,<1
commands = commands =
mypy graphene mypy graphene
[testenv:flake8] [testenv:flake8]
basepython=python3.8 basepython = python3.9
deps = deps =
flake8>=3.8,<4 flake8>=4,<5
commands = commands =
pip install --pre -e . pip install --pre -e .
flake8 graphene flake8 graphene