Skip to content

Commit bd6d8d0

Browse files
authored
Fix tests (#1119)
* Fix tests * Add extra folders to make test command * Update snapshots * Add python 3.8 to test matrix * Add black command to makefile and black dependency to setup.py * Add lint command * Run format * Remove 3.8 from test matrix * Add Python 3.8 to test matrix * Update setup.py
1 parent 81d61f8 commit bd6d8d0

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dist: xenial
44
python:
55
- "3.6"
66
- "3.7"
7+
- "3.8"
78

89
install:
910
- pip install tox tox-travis

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ help:
55

66
.PHONY: install-dev ## Install development dependencies
77
install-dev:
8-
pip install -e ".[test]"
8+
pip install -e ".[dev]"
99

1010
test:
11-
py.test graphene
11+
py.test graphene examples tests_asyncio
1212

1313
.PHONY: docs ## Generate docs
1414
docs: install-dev
@@ -17,3 +17,11 @@ docs: install-dev
1717
.PHONY: docs-live ## Generate docs with live reloading
1818
docs-live: install-dev
1919
cd docs && make install && make livehtml
20+
21+
.PHONY: format
22+
format:
23+
black graphene examples setup.py tests_asyncio
24+
25+
.PHONY: lint
26+
lint:
27+
flake8 graphene examples setup.py tests_asyncio

examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from snapshottest import Snapshot
66

7+
78
snapshots = Snapshot()
89

910
snapshots["test_correctly_fetches_id_name_rebels 1"] = {
@@ -84,9 +85,10 @@
8485
type Query {
8586
rebels: Faction
8687
empire: Faction
87-
88-
"""The ID of the object"""
89-
node(id: ID!): Node
88+
node(
89+
"""The ID of the object"""
90+
id: ID!
91+
): Node
9092
}
9193
9294
"""A ship in the Star Wars saga"""

graphene/relay/tests/test_node.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,18 @@ def test_str_schema():
183183
184184
type RootQuery {
185185
first: String
186-
187-
"""The ID of the object"""
188-
node(id: ID!): Node
189-
190-
"""The ID of the object"""
191-
onlyNode(id: ID!): MyNode
192-
193-
"""The ID of the object"""
194-
onlyNodeLazy(id: ID!): MyNode
186+
node(
187+
"""The ID of the object"""
188+
id: ID!
189+
): Node
190+
onlyNode(
191+
"""The ID of the object"""
192+
id: ID!
193+
): MyNode
194+
onlyNodeLazy(
195+
"""The ID of the object"""
196+
id: ID!
197+
): MyNode
195198
}
196199
'''
197200
)

graphene/relay/tests/test_node_custom.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ def test_str_schema_correct():
7878
}
7979
8080
type RootQuery {
81-
"""The ID of the object"""
82-
node(id: ID!): Node
81+
node(
82+
"""The ID of the object"""
83+
id: ID!
84+
): Node
8385
}
8486
8587
type User implements Node {

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def run_tests(self):
5959
"iso8601",
6060
]
6161

62+
dev_requires = ["black==19.3b0", "flake8==3.7.7"] + tests_require
63+
6264
setup(
6365
name="graphene",
6466
version=version,
@@ -76,15 +78,16 @@ def run_tests(self):
7678
"Topic :: Software Development :: Libraries",
7779
"Programming Language :: Python :: 3.6",
7880
"Programming Language :: Python :: 3.7",
81+
"Programming Language :: Python :: 3.8",
7982
],
8083
keywords="api graphql protocol rest relay graphene",
8184
packages=find_packages(exclude=["tests", "tests.*", "examples"]),
8285
install_requires=[
83-
"graphql-core>=3.0.0a0,<4",
84-
"graphql-relay>=3.0.0a0,<4",
86+
"graphql-core>=3.0.0,<4",
87+
"graphql-relay>=3.0.0,<4",
8588
"aniso8601>=6,<9",
8689
],
8790
tests_require=tests_require,
88-
extras_require={"test": tests_require},
91+
extras_require={"test": tests_require, "dev": dev_requires},
8992
cmdclass={"test": PyTest},
9093
)

0 commit comments

Comments
 (0)