From e35664ab52886fedc66dd9ec88b34b74fec5c604 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 8 Mar 2020 15:44:35 -0500 Subject: [PATCH 1/5] refactor: check if clean is callable on executor --- graphql/execution/executor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graphql/execution/executor.py b/graphql/execution/executor.py index 47dff2d3..472f95b9 100644 --- a/graphql/execution/executor.py +++ b/graphql/execution/executor.py @@ -150,7 +150,7 @@ def on_resolve(data): return promise.get() else: clean = getattr(exe_context.executor, "clean", None) - if clean: + if callable(clean): clean() return promise @@ -161,7 +161,7 @@ def execute_operation( operation, # type: OperationDefinition root_value, # type: Any ): - # type: (...) -> Union[Dict, Promise[Dict]] + # type: (...) -> Union[Dict, Promise[Dict], Observable] type = get_operation_root_type(exe_context.schema, operation) fields = collect_fields( exe_context, type, operation.selection_set, DefaultOrderedDict(list), set() @@ -278,11 +278,11 @@ def on_error(error): def map_result(data): # type: (Dict[str, Any]) -> ExecutionResult if subscriber_exe_context.errors: - result = ExecutionResult(data=data, errors=subscriber_exe_context.errors) + res = ExecutionResult(data=data, errors=subscriber_exe_context.errors) else: - result = ExecutionResult(data=data) + res = ExecutionResult(data=data) subscriber_exe_context.reset() - return result + return res def catch_error(error): subscriber_exe_context.errors.append(error) From f90350210a92e892245311b073ad247e8c3a288c Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 8 Mar 2020 15:44:53 -0500 Subject: [PATCH 2/5] refactor: cleanup print call on test --- graphql/error/tests/test_base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/graphql/error/tests/test_base.py b/graphql/error/tests/test_base.py index 3ddc091c..fa695282 100644 --- a/graphql/error/tests/test_base.py +++ b/graphql/error/tests/test_base.py @@ -89,8 +89,6 @@ def resolver(context, *_): formatted_tb = [row[2:] for row in extracted] formatted_tb = [tb for tb in formatted_tb if tb[0] != "reraise"] - print(formatted_tb) - assert formatted_tb == [ ("test_reraise_from_promise", "result.errors[0].reraise()"), ("_resolve_from_executor", "executor(resolve, reject)"), From 40fb901b6968406d102f678efebdf53e079854ad Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 8 Mar 2020 15:45:08 -0500 Subject: [PATCH 3/5] chore: bump coveralls and fetch latest gevent dep --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 04ab2283..7c5ac70a 100644 --- a/setup.py +++ b/setup.py @@ -27,8 +27,8 @@ "pytest==4.6.9", "pytest-django==3.8.0", "pytest-cov==2.8.1", - "coveralls==1.10.0", - "gevent==1.4.0", + "coveralls==1.11.1", + "gevent>=1.4.0,<1.6", "six>=1.10.0", "pytest-benchmark==3.2.3", "pytest-mock==2.0.0", From 2d3ab2941096c42f5af754c4188bab04a9fd6728 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 8 Mar 2020 15:45:55 -0500 Subject: [PATCH 4/5] chore: enable coveralls report generation --- tox.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 7a0a9309..4345dd07 100644 --- a/tox.ini +++ b/tox.ini @@ -2,11 +2,12 @@ envlist = py{27,35,36,37,py38,py,py3},pre-commit,mypy,docs [testenv] +install_command = python -m pip install --ignore-installed --pre {opts} {packages} deps = .[test] commands = - py{27,py}: pytest graphql tests {posargs} - py{35,36,37,38,py3}: pytest graphql tests tests_py35 {posargs} + py{27,py}: pytest -s --cov-report=term-missing --cov=graphql graphql tests {posargs} + py{35,36,37,38,py3}: pytest -s --cov-report=term-missing --cov=graphql graphql tests tests_py35 {posargs} [testenv:pre-commit] basepython=python3.8 From bf5ae9a840771775d4b52a3e39847f126c4c29ef Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 15 Mar 2020 11:32:33 -0500 Subject: [PATCH 5/5] chore: run coveralls only for py37 --- tox.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 4345dd07..afe8751e 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,9 @@ install_command = python -m pip install --ignore-installed --pre {opts} {package deps = .[test] commands = - py{27,py}: pytest -s --cov-report=term-missing --cov=graphql graphql tests {posargs} - py{35,36,37,38,py3}: pytest -s --cov-report=term-missing --cov=graphql graphql tests tests_py35 {posargs} + py{27,py}: pytest graphql tests {posargs} + py{35,36,38,py3}: pytest graphql tests tests_py35 {posargs} + py{37}: pytest graphql tests tests_py35 {posargs: --cov-report=term-missing --cov=graphql} [testenv:pre-commit] basepython=python3.8