Skip to content

Commit 05b3fff

Browse files
authored
add travis build (#5)
1 parent 139d19b commit 05b3fff

File tree

7 files changed

+60
-6
lines changed

7 files changed

+60
-6
lines changed

.travis.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
language: python
2+
sudo: false
3+
python:
4+
- 2.7
5+
- 3.4
6+
- 3.5
7+
- 3.6
8+
install:
9+
- |
10+
if [ "$TEST_TYPE" = build ]; then
11+
pip install -e .[test]
12+
python setup.py develop
13+
elif [ "$TEST_TYPE" = lint ]; then
14+
pip install flake8
15+
fi
16+
script:
17+
- |
18+
if [ "$TEST_TYPE" = lint ]; then
19+
echo "Checking Python code lint."
20+
flake8 graphene_tornado
21+
exit
22+
elif [ "$TEST_TYPE" = build ]; then
23+
py.test --cov=graphene_tornado graphene_tornado examples
24+
fi
25+
after_success:
26+
- |
27+
if [ "$TEST_TYPE" = build ]; then
28+
coveralls
29+
fi
30+
env:
31+
matrix:
32+
- TEST_TYPE=build
33+
matrix:
34+
fast_finish: true
35+
include:
36+
- python: '2.7'
37+
env: TEST_TYPE=build
38+
- python: '3.4'
39+
env: TEST_TYPE=build
40+
- python: '3.5'
41+
env: TEST_TYPE=build
42+
- python: '3.6'
43+
env: TEST_TYPE=build
44+
- python: '3.5'
45+
env: TEST_TYPE=build
46+
- python: '3.6'
47+
env: TEST_TYPE=build
48+
- python: '2.7'
49+
env: TEST_TYPE=lint
50+
- python: '3.6'
51+
env: TEST_TYPE=lint

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.md LICENSE

graphene_tornado/render_graphiql.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,3 @@ def render_graphiql(query, variables, operation_name, result, graphiql_version=N
192192

193193
tmpl = jinja.from_string(template)
194194
return tmpl.render(context)
195-

graphene_tornado/schema.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ def resolve_write_test(self, info):
2929

3030

3131
schema = Schema(query=QueryRoot, mutation=MutationRoot)
32-

graphene_tornado/tornado_graphql_handler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class TornadoGraphQLHandler(web.RequestHandler):
4747
graphiql_html_title = None
4848

4949
def initialize(self, schema=None, executor=None, middleware=None, root_value=None, graphiql=False, pretty=False,
50-
batch=False):
50+
batch=False):
5151
super(TornadoGraphQLHandler, self).initialize()
5252
self.schema = schema
5353
if middleware is not None:
@@ -159,7 +159,7 @@ def get_response(self, data, method, show_graphiql=False):
159159

160160
if getattr(execution_result, 'is_pending', False):
161161
event = Event()
162-
on_resolve = lambda *_: event.set()
162+
on_resolve = lambda *_: event.set() # noqa
163163
execution_result.then(on_resolve).catch(on_resolve)
164164
yield event.wait()
165165

@@ -211,7 +211,8 @@ def execute_graphql_request(self, method, query, variables, operation_name, show
211211
if show_graphiql:
212212
raise Return(None)
213213

214-
raise HTTPError(405, 'Can only perform a {} operation from a POST request.'.format(operation_ast.operation))
214+
raise HTTPError(405, 'Can only perform a {} operation from a POST request.'
215+
.format(operation_ast.operation))
215216

216217
try:
217218
result = yield self.execute(
@@ -288,7 +289,7 @@ def get_graphql_params(self, request, data):
288289
if variables and isinstance(variables, six.string_types):
289290
try:
290291
variables = json.loads(variables)
291-
except:
292+
except: # noqa
292293
raise HTTPError(400, 'Variables are invalid JSON.')
293294

294295
operation_name = single_args.get('operationName') or data.get('operationName')

requirements-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
coveralls==1.5.1
12
mock==2.0.0
23
pytest==3.10.0
34
pytest-tornado==0.5.0

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
f.read().decode('utf-8')).group(1)))
1010

1111
tests_require = [
12+
'coveralls',
1213
'mock',
1314
'pytest',
15+
'pytest-cov',
1416
'pytest-tornado'
1517
]
1618

0 commit comments

Comments
 (0)