Skip to content

Travis uses tox #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 20 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
language: python
sudo: false
python:
- 2.7
# - "pypy-5.3.1"
install:
- pip install -e .[test]
- pip install flake8
script:
- flake8
- py.test --cov=graphql graphql tests
after_success:
- coveralls
matrix:
include:
- python: '3.5'
after_install:
- pip install pytest-asyncio
script:
- py.test --cov=graphql graphql tests tests_py35
- python: '3.6'
install:
- pip install -e .[test]
- pip install pytest-asyncio mypy
script:
- py.test --cov=graphql graphql tests tests_py35
- mypy graphql --ignore-missing-imports
- python: '2.7'

- env: TOXENV=py27
- env: TOXENV=py34
python: 3.4
- env: TOXENV=py35
python: 3.5
- env: TOXENV=py36
python: 3.6
- env: TOXENV=pypy
python: pypy-5.7.1
- env: TOXENV=pre-commit
python: 3.6
- env: TOXENV=mypy
python: 3.6
install: pip install coveralls tox
script: tox
after_success: coveralls
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/pre-commit
deploy:
provider: pypi
user: syrusakbary
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from abc import ABCMeta, abstractmethod
import six


# Necessary for static type checking
if False: # flake8: noqa
from typing import Dict, Optional, Union, Callable
Expand Down
1 change: 1 addition & 0 deletions graphql/backend/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from hashlib import sha1

from six import string_types
from ..type import GraphQLSchema

Expand Down
8 changes: 2 additions & 6 deletions graphql/execution/tests/test_located_error.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# type: ignore
# coding: utf-8

from graphql import GraphQLField
from graphql import GraphQLObjectType
from graphql import GraphQLSchema
from graphql import GraphQLString
from graphql import execute
from graphql import parse
from graphql import (GraphQLField, GraphQLObjectType, GraphQLSchema,
GraphQLString, execute, parse)
from graphql.error import GraphQLLocatedError


Expand Down
1 change: 0 additions & 1 deletion graphql/execution/tests/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from collections import OrderedDict

from pytest import raises

from graphql.error import GraphQLError, format_error
from graphql.execution import execute
from graphql.language.parser import parse
Expand Down
4 changes: 2 additions & 2 deletions graphql/language/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def read_string(source, start):

position += 1
if code == 92: # \
append(body[chunk_start : position - 1])
append(body[chunk_start: position - 1])

code = char_code_at(body, position)
escaped = ESCAPED_CHAR_CODES.get(code) # type: ignore
Expand All @@ -392,7 +392,7 @@ def read_string(source, start):
source,
position,
u"Invalid character escape sequence: \\u{}.".format(
body[position + 1 : position + 5]
body[position + 1: position + 5]
),
)

Expand Down
1 change: 0 additions & 1 deletion graphql/pyutils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,3 @@ def check_threads():
'(Enable the "enable-threads" flag).'
)
)

14 changes: 7 additions & 7 deletions graphql/type/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,17 +626,17 @@ class GeoPoint(GraphQLInputObjectType):
"""

def __init__(self,
name, # type: str
fields, # type: Union[Callable[[], Dict[str, GraphQLInputObjectField]], Dict[str, GraphQLInputObjectField]]
description=None, # type: Optional[str]
container_type=None, # type: Type[Dict[str, Any]]
):
name, # type: str
fields, # type: Union[Callable[[], Dict[str, GraphQLInputObjectField]], Dict[str, GraphQLInputObjectField]]
description=None, # type: Optional[str]
container_type=None, # type: Type[Dict[str, Any]]
):
# type: (...) -> None
assert name, "Type must be named."
self.name = name
self.description = description
if container_type is None:
container_type = dict # type: ignore
container_type = dict # type: ignore
assert callable(container_type), "container_type must be callable"
self.container_type = container_type
self._fields = fields
Expand Down Expand Up @@ -755,7 +755,7 @@ class RowType(GraphQLObjectType):

def __init__(
self,
type, # type: Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]
type, # type: Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]
):
# type: (...) -> None
assert is_type(type) and not isinstance(
Expand Down
1 change: 0 additions & 1 deletion graphql/type/tests/test_definition.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections import OrderedDict

from py.test import raises

from graphql.type import (
Expand Down
2 changes: 0 additions & 2 deletions graphql/type/tests/test_enum_type.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from collections import OrderedDict

from rx import Observable

from graphql import graphql
from graphql.type import (
GraphQLArgument,
Expand Down
4 changes: 2 additions & 2 deletions graphql/validation/rules/overlapping_fields_can_be_merged.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _find_conflicts_within_selection_set(
# selection set to collect conflicts within fragments spread together.
# This compares each item in the list of fragment names to every other item
# in that same list (except for itself).
for other_fragment_name in fragment_names[i + 1 :]:
for other_fragment_name in fragment_names[i + 1:]:
_collect_conflicts_between_fragments(
context,
conflicts,
Expand Down Expand Up @@ -444,7 +444,7 @@ def _collect_conflicts_within(
# (except to itself). If the list only has one item, nothing needs to
# be compared.
for i, field in enumerate(fields):
for other_field in fields[i + 1 :]:
for other_field in fields[i + 1:]:
# within one collection is never mutually exclusive
conflict = _find_conflict(
context,
Expand Down
18 changes: 7 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = flake8,isort,py27,py33,py34,py35,py36,pre-commit,pypy,docs
envlist = py27,py34,py35,py36,pre-commit,pypy,mypy,docs

[testenv]
deps =
Expand All @@ -10,7 +10,7 @@ deps =
pytest-mock
pytest-benchmark
commands =
py{27,33,34,py}: py.test graphql tests {posargs}
py{27,34,py}: py.test graphql tests {posargs}
py{35,36}: py.test graphql tests tests_py35 {posargs}

[testenv:pre-commit]
Expand All @@ -22,16 +22,12 @@ setenv =
commands =
pre-commit {posargs:run --all-files}

[testenv:flake8]
deps = flake8
commands = flake8

[testenv:isort]
basepython=python3.5
[testenv:mypy]
basepython=python3.6
deps =
isort==3.9.6
gevent==1.1rc1
commands = isort -rc graphql
mypy
commands =
mypy graphql --ignore-missing-imports

[testenv:docs]
changedir = docs
Expand Down