Skip to content

Commit 91fb8c2

Browse files
authored
Merge pull request #188 from dan98765/travis_uses_tox
Travis uses tox
2 parents 148cdb4 + c663913 commit 91fb8c2

File tree

12 files changed

+42
-59
lines changed

12 files changed

+42
-59
lines changed

.travis.yml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
language: python
2-
sudo: false
3-
python:
4-
- 2.7
5-
# - "pypy-5.3.1"
6-
install:
7-
- pip install -e .[test]
8-
- pip install flake8
9-
script:
10-
- flake8
11-
- py.test --cov=graphql graphql tests
12-
after_success:
13-
- coveralls
142
matrix:
153
include:
16-
- python: '3.5'
17-
after_install:
18-
- pip install pytest-asyncio
19-
script:
20-
- py.test --cov=graphql graphql tests tests_py35
21-
- python: '3.6'
22-
install:
23-
- pip install -e .[test]
24-
- pip install pytest-asyncio mypy
25-
script:
26-
- py.test --cov=graphql graphql tests tests_py35
27-
- mypy graphql --ignore-missing-imports
28-
- python: '2.7'
29-
4+
- env: TOXENV=py27
5+
- env: TOXENV=py34
6+
python: 3.4
7+
- env: TOXENV=py35
8+
python: 3.5
9+
- env: TOXENV=py36
10+
python: 3.6
11+
- env: TOXENV=pypy
12+
python: pypy-5.7.1
13+
- env: TOXENV=pre-commit
14+
python: 3.6
15+
- env: TOXENV=mypy
16+
python: 3.6
17+
install: pip install coveralls tox
18+
script: tox
19+
after_success: coveralls
20+
cache:
21+
directories:
22+
- $HOME/.cache/pip
23+
- $HOME/.cache/pre-commit
3024
deploy:
3125
provider: pypi
3226
user: syrusakbary

graphql/backend/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from abc import ABCMeta, abstractmethod
55
import six
66

7+
78
# Necessary for static type checking
89
if False: # flake8: noqa
910
from typing import Dict, Optional, Union, Callable

graphql/backend/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from hashlib import sha1
2+
23
from six import string_types
34
from ..type import GraphQLSchema
45

graphql/execution/tests/test_located_error.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# type: ignore
22
# coding: utf-8
33

4-
from graphql import GraphQLField
5-
from graphql import GraphQLObjectType
6-
from graphql import GraphQLSchema
7-
from graphql import GraphQLString
8-
from graphql import execute
9-
from graphql import parse
4+
from graphql import (GraphQLField, GraphQLObjectType, GraphQLSchema,
5+
GraphQLString, execute, parse)
106
from graphql.error import GraphQLLocatedError
117

128

graphql/execution/tests/test_variables.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections import OrderedDict
44

55
from pytest import raises
6-
76
from graphql.error import GraphQLError, format_error
87
from graphql.execution import execute
98
from graphql.language.parser import parse

graphql/language/lexer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def read_string(source, start):
372372

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

377377
code = char_code_at(body, position)
378378
escaped = ESCAPED_CHAR_CODES.get(code) # type: ignore
@@ -392,7 +392,7 @@ def read_string(source, start):
392392
source,
393393
position,
394394
u"Invalid character escape sequence: \\u{}.".format(
395-
body[position + 1 : position + 5]
395+
body[position + 1: position + 5]
396396
),
397397
)
398398

graphql/pyutils/compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,3 @@ def check_threads():
240240
'(Enable the "enable-threads" flag).'
241241
)
242242
)
243-

graphql/type/definition.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,17 +626,17 @@ class GeoPoint(GraphQLInputObjectType):
626626
"""
627627

628628
def __init__(self,
629-
name, # type: str
630-
fields, # type: Union[Callable[[], Dict[str, GraphQLInputObjectField]], Dict[str, GraphQLInputObjectField]]
631-
description=None, # type: Optional[str]
632-
container_type=None, # type: Type[Dict[str, Any]]
633-
):
629+
name, # type: str
630+
fields, # type: Union[Callable[[], Dict[str, GraphQLInputObjectField]], Dict[str, GraphQLInputObjectField]]
631+
description=None, # type: Optional[str]
632+
container_type=None, # type: Type[Dict[str, Any]]
633+
):
634634
# type: (...) -> None
635635
assert name, "Type must be named."
636636
self.name = name
637637
self.description = description
638638
if container_type is None:
639-
container_type = dict # type: ignore
639+
container_type = dict # type: ignore
640640
assert callable(container_type), "container_type must be callable"
641641
self.container_type = container_type
642642
self._fields = fields
@@ -755,7 +755,7 @@ class RowType(GraphQLObjectType):
755755

756756
def __init__(
757757
self,
758-
type, # type: Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]
758+
type, # type: Union[GraphQLList, GraphQLObjectType, GraphQLScalarType, GraphQLInputObjectType, GraphQLInterfaceType]
759759
):
760760
# type: (...) -> None
761761
assert is_type(type) and not isinstance(

graphql/type/tests/test_definition.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from collections import OrderedDict
2-
32
from py.test import raises
43

54
from graphql.type import (

graphql/type/tests/test_enum_type.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from collections import OrderedDict
2-
32
from rx import Observable
4-
53
from graphql import graphql
64
from graphql.type import (
75
GraphQLArgument,

graphql/validation/rules/overlapping_fields_can_be_merged.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _find_conflicts_within_selection_set(
207207
# selection set to collect conflicts within fragments spread together.
208208
# This compares each item in the list of fragment names to every other item
209209
# in that same list (except for itself).
210-
for other_fragment_name in fragment_names[i + 1 :]:
210+
for other_fragment_name in fragment_names[i + 1:]:
211211
_collect_conflicts_between_fragments(
212212
context,
213213
conflicts,
@@ -444,7 +444,7 @@ def _collect_conflicts_within(
444444
# (except to itself). If the list only has one item, nothing needs to
445445
# be compared.
446446
for i, field in enumerate(fields):
447-
for other_field in fields[i + 1 :]:
447+
for other_field in fields[i + 1:]:
448448
# within one collection is never mutually exclusive
449449
conflict = _find_conflict(
450450
context,

tox.ini

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = flake8,isort,py27,py33,py34,py35,py36,pre-commit,pypy,docs
2+
envlist = py27,py34,py35,py36,pre-commit,pypy,mypy,docs
33

44
[testenv]
55
deps =
@@ -10,7 +10,7 @@ deps =
1010
pytest-mock
1111
pytest-benchmark
1212
commands =
13-
py{27,33,34,py}: py.test graphql tests {posargs}
13+
py{27,34,py}: py.test graphql tests {posargs}
1414
py{35,36}: py.test graphql tests tests_py35 {posargs}
1515

1616
[testenv:pre-commit]
@@ -22,16 +22,12 @@ setenv =
2222
commands =
2323
pre-commit {posargs:run --all-files}
2424

25-
[testenv:flake8]
26-
deps = flake8
27-
commands = flake8
28-
29-
[testenv:isort]
30-
basepython=python3.5
25+
[testenv:mypy]
26+
basepython=python3.6
3127
deps =
32-
isort==3.9.6
33-
gevent==1.1rc1
34-
commands = isort -rc graphql
28+
mypy
29+
commands =
30+
mypy graphql --ignore-missing-imports
3531

3632
[testenv:docs]
3733
changedir = docs

0 commit comments

Comments
 (0)