Skip to content

Commit eef0919

Browse files
committed
Use newer pytest, desupport Python 3.3 and 3.4, require Core 2.3
1 parent b99207a commit eef0919

File tree

7 files changed

+36
-41
lines changed

7 files changed

+36
-41
lines changed

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ matrix:
33
include:
44
- python: "3.7"
55
env: TOX_ENV=black,flake8,mypy,py37
6-
dist: xenial
7-
sudo: true
86
- python: "3.6"
97
env: TOX_ENV=py36
108
- python: "3.5"
119
env: TOX_ENV=py35
12-
- python: "3.4"
13-
env: TOX_ENV=py34
1410
- python: "2.7"
1511
env: TOX_ENV=py27
16-
- python: pypy3.5
12+
- python: pypy3
1713
env: TOX_ENV=pypy3
1814
- python: pypy
1915
env: TOX_ENV=pypy
@@ -29,9 +25,11 @@ after_success:
2925
- codecov
3026
deploy:
3127
provider: pypi
32-
user: __token__
33-
password:
34-
secure: WcZf7AVMDzheXWUxNhZF/TUcyvyCdHZGyhHTakjBhUs8I8khSvlMPofaXTdN1Qn3WbHPK+IXeIPh/2NX0Le3Cdzp08Q/Tgrf9EZ4y02UrZxwSxtsUmjCVd8GaCsQnhR5t5cgrtw33OAf0O22rUnMXsFtw7xMIuCNTgFiYclNbHzYbvnJAEcY3qE8RBbP8zF5Brx+Bl49SjfVR3dJ7CBkjgC9scZjSBAo/yc64d506W59LOjfvXEiDtGUH2gxZNwNiteZtI3frMYqLRjS563SwEFlG36B8g0hBOj6FVpU+YXeImYXw3XFqC6dCvcwn1dAf/vUZ4IDiDIVf5KvFcyDx0ZwZlMSzqlkLVpSDGqPU+7Mx15NW00Yk2+Zs2ZWFMK+g5WtSehhrAWR6El3d0MRlDXKgt9QbCRyh8b2jPV/vQZN2FOBOg9V9a6IszOy/W1J81q39cLOroBhQF4mDFYTAQ5QpBVUyauAfB49QzXsmSWy2uOTsbgo+oAc+OGJ6q9vXCzNqHxhUvtDT9HIq4w5ixw9wqtpSf6n+l2F2RFl5SzHIR7Dt0m9Eg2Ig5NqSGlymz46ZcxpRjd4wVXALD4M8usqy35jGTeEXsqSTO98n3jwKTj/7Xi6GOZuBlwW+SGAjXQ0vzlWD3AEv0Jnh+4AH5UqWwBeD1skw8gtbjM4dos=
3528
on:
29+
branch: master
3630
tags: true
3731
python: 3.7
32+
skip_existing: true
33+
user: __token__
34+
password:
35+
secure: WcZf7AVMDzheXWUxNhZF/TUcyvyCdHZGyhHTakjBhUs8I8khSvlMPofaXTdN1Qn3WbHPK+IXeIPh/2NX0Le3Cdzp08Q/Tgrf9EZ4y02UrZxwSxtsUmjCVd8GaCsQnhR5t5cgrtw33OAf0O22rUnMXsFtw7xMIuCNTgFiYclNbHzYbvnJAEcY3qE8RBbP8zF5Brx+Bl49SjfVR3dJ7CBkjgC9scZjSBAo/yc64d506W59LOjfvXEiDtGUH2gxZNwNiteZtI3frMYqLRjS563SwEFlG36B8g0hBOj6FVpU+YXeImYXw3XFqC6dCvcwn1dAf/vUZ4IDiDIVf5KvFcyDx0ZwZlMSzqlkLVpSDGqPU+7Mx15NW00Yk2+Zs2ZWFMK+g5WtSehhrAWR6El3d0MRlDXKgt9QbCRyh8b2jPV/vQZN2FOBOg9V9a6IszOy/W1J81q39cLOroBhQF4mDFYTAQ5QpBVUyauAfB49QzXsmSWy2uOTsbgo+oAc+OGJ6q9vXCzNqHxhUvtDT9HIq4w5ixw9wqtpSf6n+l2F2RFl5SzHIR7Dt0m9Eg2Ig5NqSGlymz46ZcxpRjd4wVXALD4M8usqy35jGTeEXsqSTO98n3jwKTj/7Xi6GOZuBlwW+SGAjXQ0vzlWD3AEv0Jnh+4AH5UqWwBeD1skw8gtbjM4dos=

graphql_server/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ def execute_graphql_request(
296296

297297
try:
298298
return document.execute(
299-
operation_name=params.operation_name, variables=params.variables, **kwargs
299+
operation_name=params.operation_name,
300+
variable_values=params.variables,
301+
**kwargs
300302
)
301303
except Exception as e:
302304
return ExecutionResult(errors=[e], invalid=True)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ max-line-length = 88
66
known_first_party=graphql_server
77

88
[tool:pytest]
9-
norecursedirs = venv .tox .cache
9+
norecursedirs = venv .venv .tox .git .cache .mypy_cache .pytest_cache
1010

1111
[bdist_wheel]
1212
universal=1

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from setuptools import setup, find_packages
22

3-
required_packages = ["graphql-core>=2.1,<3", "promise"]
3+
required_packages = ["graphql-core>=2.3,<3", "promise>=2.3,<3"]
4+
tests_require = ["pytest==4.6.9", "pytest-cov==2.8.1"]
45

56
setup(
67
name="graphql-server-core",
7-
version="1.1.3",
8+
version="1.2.0",
89
description="GraphQL Server tools for powering your server",
910
long_description=open("README.md").read(),
1011
long_description_content_type="text/markdown",
@@ -20,8 +21,6 @@
2021
"Programming Language :: Python :: 2",
2122
"Programming Language :: Python :: 2.7",
2223
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.3",
24-
"Programming Language :: Python :: 3.4",
2524
"Programming Language :: Python :: 3.5",
2625
"Programming Language :: Python :: 3.6",
2726
"Programming Language :: Python :: 3.7",
@@ -32,7 +31,8 @@
3231
keywords="api graphql protocol rest",
3332
packages=find_packages(exclude=["tests"]),
3433
install_requires=required_packages,
35-
tests_require=["pytest>=3.0,<4"],
34+
tests_require=tests_require,
35+
extras_require={"test": tests_require},
3636
include_package_data=True,
3737
zip_safe=False,
3838
platforms="any",

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
3+
if sys.version_info[:2] < (3, 4):
4+
collect_ignore_glob = ["*_asyncio.py"]

tests/test_asyncio.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# flake8: noqa
1+
import asyncio
22

3-
import pytest
4-
5-
asyncio = pytest.importorskip("asyncio")
3+
from promise import Promise
64

75
from graphql.execution.executors.asyncio import AsyncioExecutor
86
from graphql.type.definition import (
@@ -13,7 +11,6 @@
1311
from graphql.type.scalars import GraphQLString
1412
from graphql.type.schema import GraphQLSchema
1513
from graphql_server import RequestParams, run_http_query
16-
from promise import Promise
1714

1815
from .utils import as_dicts
1916

@@ -22,19 +19,17 @@ def resolve_error_sync(_obj, _info):
2219
raise ValueError("error sync")
2320

2421

25-
@asyncio.coroutine
26-
def resolve_error_async(_obj, _info):
27-
yield from asyncio.sleep(0.001)
22+
async def resolve_error_async(_obj, _info):
23+
await asyncio.sleep(0.001)
2824
raise ValueError("error async")
2925

3026

3127
def resolve_field_sync(_obj, _info):
3228
return "sync"
3329

3430

35-
@asyncio.coroutine
36-
def resolve_field_async(_obj, info):
37-
yield from asyncio.sleep(0.001)
31+
async def resolve_field_async(_obj, info):
32+
await asyncio.sleep(0.001)
3833
return "async"
3934

4035

@@ -53,7 +48,7 @@ def resolve_field_async(_obj, info):
5348
schema = GraphQLSchema(QueryRootType)
5449

5550

56-
def test_get_reponses_using_asyncioexecutor():
51+
def test_get_responses_using_asyncio_executor():
5752
class TestExecutor(AsyncioExecutor):
5853
called = False
5954
waited = False
@@ -75,8 +70,7 @@ def execute(self, fn, *args, **kwargs):
7570

7671
loop = asyncio.get_event_loop()
7772

78-
@asyncio.coroutine
79-
def get_results():
73+
async def get_results():
8074
result_promises, params = run_http_query(
8175
schema,
8276
"get",
@@ -85,7 +79,7 @@ def get_results():
8579
executor=TestExecutor(loop=loop),
8680
return_promise=True,
8781
)
88-
results = yield from Promise.all(result_promises)
82+
results = await Promise.all(result_promises)
8983
return results, params
9084

9185
results, params = loop.run_until_complete(get_results())

tox.ini

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11
[tox]
2-
envlist = black,flake8,mypy,py38,py37,py36,py35,py34,py33,py27,pypy3,pypy
2+
envlist = black,flake8,mypy,py{38,37,36,35,py27,py3,py}
33
skipsdist = true
44

55
[testenv]
66
setenv =
77
PYTHONPATH = {toxinidir}
88
deps =
9-
pytest>=3.0,<4
10-
graphql-core>=2.1,<3
11-
pytest-cov>=2.7
9+
.[test]
1210
commands =
13-
py{py,27}: py.test tests {posargs} --ignore=tests/test_asyncio.py
14-
py{py3,33,34,35,36,37,38}: py.test tests {posargs}
11+
pytest tests {posargs}
1512

1613
[testenv:black]
1714
basepython=python3.7
18-
deps = black
15+
deps = black==19.10b0
1916
commands =
2017
black --check graphql_server tests
2118

2219
[testenv:flake8]
2320
basepython=python3.7
24-
deps = flake8
21+
deps = flake8==3.7.9
2522
commands =
26-
flake8 graphql_server tests
23+
flake8 setup.py graphql_server tests
2724

2825
[testenv:isort]
2926
basepython=python3.7
3027
deps =
3128
isort
32-
graphql-core>=2.1,<3
29+
graphql-core>=2.3,<3
3330
commands =
3431
isort -rc graphql_server/ tests/
3532

3633
[testenv:mypy]
3734
basepython=python3.7
38-
deps = mypy
35+
deps = mypy==0.761
3936
commands =
4037
mypy graphql_server tests --ignore-missing-imports
4138

0 commit comments

Comments
 (0)