diff --git a/.travis.yml b/.travis.yml index f71c862..d335468 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,25 @@ language: python -sudo: false + +python: + - 3.6 + - 3.7 + - 3.8 + matrix: include: - - python: '3.5' - env: TOX_ENV=py35,flake8 - - python: '3.6' - env: TOX_ENV=py36 + - python: '3.7' + env: TOXENV=flake8 + cache: directories: - $HOME/.cache/pip - $TRAVIS_BUILD_DIR/.tox + install: -- pip install tox coveralls + - pip install tox tox-travis coveralls + script: -- tox -e $TOX_ENV + - tox + after_success: -- coveralls + - coveralls diff --git a/setup.py b/setup.py index 59f7617..6e2e5d6 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,37 @@ from setuptools import setup, find_packages required_packages = [ - 'graphql-core>=2.1', - 'graphql-server-core>=1.1.1', - 'sanic>=0.5.1', - 'pytest-runner' + "graphql-core>=2.1,<3", + "graphql-server-core>=1.1.1,<2", + "sanic>=0.5.1,<19", ] +tests_require = ["pytest>=2.7.3", "aiohttp>=3.5.0,<4", "yarl>=1.0,<2.0", "jinja2==2.9.0"] + setup( - name='Sanic-GraphQL', - version='1.1.0', - description='Adds GraphQL support to your Sanic application', - long_description=open('README.rst').read(), - url='https://github.com/graphql-python/sanic-graphql', - download_url='https://github.com/graphql-python/sanic-graphql/releases', - author='Sergey Porivaev', - author_email='porivaevs@gmail.com', - license='MIT', + name="Sanic-GraphQL", + version="1.1.0", + description="Adds GraphQL support to your Sanic application", + long_description=open("README.rst", encoding="utf-8").read(), + url="https://github.com/graphql-python/sanic-graphql", + download_url="https://github.com/graphql-python/sanic-graphql/releases", + author="Sergey Porivaev", + author_email="porivaevs@gmail.com", + license="MIT", classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'License :: OSI Approved :: MIT License', + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "License :: OSI Approved :: MIT License", ], - keywords='api graphql protocol sanic', - packages=find_packages(exclude=['tests']), + keywords="api graphql protocol sanic", + packages=find_packages(exclude=["tests"]), install_requires=required_packages, - tests_require=['pytest>=2.7.3', 'aiohttp>=1.3.0', 'yarl>=0.9.6', 'jinja2>=2.9.0'], + tests_require=tests_require, + extras_require={"test": tests_require}, include_package_data=True, - platforms='any', + platforms="any", ) diff --git a/tests/test_graphiqlview.py b/tests/test_graphiqlview.py index 66cc8cb..5fdbf4d 100644 --- a/tests/test_graphiqlview.py +++ b/tests/test_graphiqlview.py @@ -19,7 +19,7 @@ def pretty_response(): @parametrize_sync_async_app_test('app', graphiql=True) def test_graphiql_is_enabled(app): - _, response = app.client.get( uri=url_string(), headers={'Accept': 'text/html'}) + _, response = app.client.get(uri=url_string(query="{test}"), headers={'Accept': 'text/html'}) assert response.status == 200 @@ -50,14 +50,6 @@ def test_graphiql_html_is_not_accepted(app): assert response.status == 400 -@parametrize_sync_async_app_test('app', graphiql=True) -def test_graphiql_get_mutation(app, pretty_response): - query = 'mutation TestMutation { writeTest { test } }' - _, response = app.client.get(uri=url_string(query=query), headers={'Accept': 'text/html'}) - assert response.status == 200 - assert 'response: null' in response.body.decode('utf-8') - - @pytest.mark.parametrize('app', [create_app(async_executor=True, graphiql=True, schema=AsyncSchema)]) def test_graphiql_asyncio_schema(app): query = '{a,b,c}' diff --git a/tox.ini b/tox.ini index 2612ab4..6275bd4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,13 @@ [tox] -envlist = py35, py36, flake8 +envlist = flake8,py36,py37,py38 skipsdist = true -[travis] -python = - 3.5: py35, flake8 - 3.6: py36, flake8 - [testenv] deps = - pytest>=2.7.2 - graphql-core>=1.0 - graphql-server-core>=1.0.dev - sanic>=0.3.1 - aiohttp>=1.3.0 - jinja2>=2.9.0 - yarl>=0.9.6 - pytest-runner - coverage + .[test] commands = - coverage run --source=sanic_graphql setup.py test + {posargs:py.test tests} [testenv:flake8] deps = flake8