From bd6d8d086dc350ab23f2ba56aee16de12bad53cf Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Tue, 31 Dec 2019 14:08:30 +0000 Subject: [PATCH] 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 --- .travis.yml | 1 + Makefile | 12 +++++++++-- .../snap_test_objectidentification.py | 8 ++++--- graphene/relay/tests/test_node.py | 21 +++++++++++-------- graphene/relay/tests/test_node_custom.py | 6 ++++-- setup.py | 9 +++++--- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5d15f2d..e1e55119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ dist: xenial python: - "3.6" - "3.7" + - "3.8" install: - pip install tox tox-travis diff --git a/Makefile b/Makefile index b4e6c928..df3b4118 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,10 @@ help: .PHONY: install-dev ## Install development dependencies install-dev: - pip install -e ".[test]" + pip install -e ".[dev]" test: - py.test graphene + py.test graphene examples tests_asyncio .PHONY: docs ## Generate docs docs: install-dev @@ -17,3 +17,11 @@ docs: install-dev .PHONY: docs-live ## Generate docs with live reloading docs-live: install-dev cd docs && make install && make livehtml + +.PHONY: format +format: + black graphene examples setup.py tests_asyncio + +.PHONY: lint +lint: + flake8 graphene examples setup.py tests_asyncio diff --git a/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py b/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py index cb57709a..02e61c39 100644 --- a/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py +++ b/examples/starwars_relay/tests/snapshots/snap_test_objectidentification.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from snapshottest import Snapshot + snapshots = Snapshot() snapshots["test_correctly_fetches_id_name_rebels 1"] = { @@ -84,9 +85,10 @@ type PageInfo { type Query { rebels: Faction empire: Faction - - """The ID of the object""" - node(id: ID!): Node + node( + """The ID of the object""" + id: ID! + ): Node } """A ship in the Star Wars saga""" diff --git a/graphene/relay/tests/test_node.py b/graphene/relay/tests/test_node.py index c322b1a3..62fd31a3 100644 --- a/graphene/relay/tests/test_node.py +++ b/graphene/relay/tests/test_node.py @@ -183,15 +183,18 @@ def test_str_schema(): type RootQuery { first: String - - """The ID of the object""" - node(id: ID!): Node - - """The ID of the object""" - onlyNode(id: ID!): MyNode - - """The ID of the object""" - onlyNodeLazy(id: ID!): MyNode + node( + """The ID of the object""" + id: ID! + ): Node + onlyNode( + """The ID of the object""" + id: ID! + ): MyNode + onlyNodeLazy( + """The ID of the object""" + id: ID! + ): MyNode } ''' ) diff --git a/graphene/relay/tests/test_node_custom.py b/graphene/relay/tests/test_node_custom.py index 773be48f..6f28eb66 100644 --- a/graphene/relay/tests/test_node_custom.py +++ b/graphene/relay/tests/test_node_custom.py @@ -78,8 +78,10 @@ def test_str_schema_correct(): } type RootQuery { - """The ID of the object""" - node(id: ID!): Node + node( + """The ID of the object""" + id: ID! + ): Node } type User implements Node { diff --git a/setup.py b/setup.py index d50aeba1..58ec7345 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,8 @@ tests_require = [ "iso8601", ] +dev_requires = ["black==19.3b0", "flake8==3.7.7"] + tests_require + setup( name="graphene", version=version, @@ -76,15 +78,16 @@ setup( "Topic :: Software Development :: Libraries", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", ], keywords="api graphql protocol rest relay graphene", packages=find_packages(exclude=["tests", "tests.*", "examples"]), install_requires=[ - "graphql-core>=3.0.0a0,<4", - "graphql-relay>=3.0.0a0,<4", + "graphql-core>=3.0.0,<4", + "graphql-relay>=3.0.0,<4", "aniso8601>=6,<9", ], tests_require=tests_require, - extras_require={"test": tests_require}, + extras_require={"test": tests_require, "dev": dev_requires}, cmdclass={"test": PyTest}, )