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)"), 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) diff --git a/setup.py b/setup.py index c8cd2311..73730ec2 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", diff --git a/tox.ini b/tox.ini index 8b2bfc02..afe8751e 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ 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 =