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:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Build wheel and source tarball
run: |
pip install wheel

View File

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

View File

@ -25,6 +25,8 @@ jobs:
fail-fast: false
matrix:
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.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}

View File

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

View File

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

View File

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

16
tox.ini
View File

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