graphql-python / graphql-python/graphene

TestUnforgivinExeuctionContext.test_unexpected_error fails

Abierto
#1,346 1 comentario 0 reacciones 0 asignados Ver en GitHub
🐛 bug
Lenguaje dominante
Python
Estrellas
8.2k
Forks
818
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.

* **What is the current behavior?**

TestUnforgivinExeuctionContext.test_unexpected_error fails.

```
============================= test session starts ==============================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.2.2 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /build/source, configfile: tox.ini
plugins: asyncio-0.15.1, benchmark-3.2.2, mock-3.6.1, snapshottest-0.6.0
collected 389 items

examples/starwars/tests/test_query.py ............. [ 3%]
examples/starwars_relay/tests/test_connections.py . [ 3%]
examples/starwars_relay/tests/test_mutation.py . [ 3%]
examples/starwars_relay/tests/test_objectidentification.py ...... [ 5%]
graphene/relay/tests/test_connection.py ........... [ 8%]
graphene/relay/tests/test_connection_async.py . [ 8%]
graphene/relay/tests/test_connection_query.py ..................... [ 13%]
graphene/relay/tests/test_global_id.py .... [ 14%]
graphene/relay/tests/test_mutation.py ......... [ 17%]
graphene/relay/tests/test_mutation_async.py .. [ 17%]
graphene/relay/tests/test_node.py .............. [ 21%]
graphene/relay/tests/test_node_custom.py ........... [ 24%]
graphene/tests/issues/test_313.py . [ 24%]
graphene/tests/issues/test_356.py . [ 24%]
graphene/tests/issues/test_425.py ......... [ 26%]
graphene/tests/issues/test_490.py . [ 27%]
graphene/tests/issues/test_720.py . [ 27%]
graphene/tests/issues/test_956.py . [ 27%]
graphene/types/tests/test_argument.py ........ [ 29%]
graphene/types/tests/test_base.py ..... [ 31%]
graphene/types/tests/test_base64.py ....... [ 32%]
graphene/types/tests/test_datetime.py ............. [ 36%]
graphene/types/tests/test_decimal.py .... [ 37%]
graphene/types/tests/test_definition.py .......... [ 39%]
graphene/types/tests/test_dynamic.py ..... [ 41%]
graphene/types/tests/test_enum.py ...................... [ 46%]
graphene/types/tests/test_field.py .............. [ 50%]
graphene/types/tests/test_generic.py .. [ 50%]
graphene/types/tests/test_inputfield.py .... [ 51%]
graphene/types/tests/test_inputobjecttype.py ......... [ 54%]
graphene/types/tests/test_interface.py ........... [ 57%]
graphene/types/tests/test_json.py .. [ 57%]
graphene/types/tests/test_mountedtype.py .. [ 58%]
graphene/types/tests/test_mutation.py ......... [ 60%]
graphene/types/tests/test_objecttype.py ............................ [ 67%]
graphene/types/tests/test_query.py .................... [ 72%]
graphene/types/tests/test_resolver.py ....... [ 74%]
graphene/types/tests/test_scalar.py .. [ 75%]
graphene/types/tests/test_scalars_serialization.py .... [ 76%]
graphene/types/tests/test_schema.py ..........FFFFFFFFF [ 80%]
graphene/types/tests/test_structures.py ................ [ 85%]
graphene/types/tests/test_subscribe_async.py .... [ 86%]
graphene/types/tests/test_type_map.py ........ [ 88%]
graphene/types/tests/test_union.py .... [ 89%]
graphene/types/tests/test_uuid.py .. [ 89%]
graphene/utils/tests/test_crunch.py ............... [ 93%]
graphene/utils/tests/test_deduplicator.py ..... [ 94%]
graphene/utils/tests/test_deprecated.py ...... [ 96%]
graphene/utils/tests/test_module_loading.py ..... [ 97%]
graphene/utils/tests/test_orderedtype.py ..... [ 98%]
graphene/utils/tests/test_resolve_only_args.py . [ 99%]
graphene/utils/tests/test_str_converters.py .. [ 99%]
graphene/utils/tests/test_trim_docstring.py . [100%]

=================================== FAILURES ===================================
_ TestUnforgivingExecutionContext.test_unexpected_error[unexpectedValueErrorField-ValueError] _

self =
field = 'unexpectedValueErrorField', exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[unexpectedTypeErrorField-TypeError] _

self =
field = 'unexpectedTypeErrorField', exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[unexpectedAttributeErrorField-AttributeError] _

self =
field = 'unexpectedAttributeErrorField', exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[unexpectedKeyErrorField-KeyError] _

self =
field = 'unexpectedKeyErrorField', exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[nestedObject { unexpectedValueErrorField }-ValueError] _

self =
field = 'nestedObject { unexpectedValueErrorField }'
exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[nestedObject { unexpectedTypeErrorField }-TypeError] _

self =
field = 'nestedObject { unexpectedTypeErrorField }'
exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[nestedObject { unexpectedAttributeErrorField }-AttributeError] _

self =
field = 'nestedObject { unexpectedAttributeErrorField }'
exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[nestedObject { unexpectedKeyErrorField }-KeyError] _

self =
field = 'nestedObject { unexpectedKeyErrorField }'
exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
_ TestUnforgivingExecutionContext.test_unexpected_error[nestedObjectError { __typename }-TypeError] _

self =
field = 'nestedObjectError { __typename }', exception =
schema =

@mark.parametrize(
"field,exception",
[
("unexpectedValueErrorField", ValueError),
("unexpectedTypeErrorField", TypeError),
("unexpectedAttributeErrorField", AttributeError),
("unexpectedKeyErrorField", KeyError),
("nestedObject { unexpectedValueErrorField }", ValueError),
("nestedObject { unexpectedTypeErrorField }", TypeError),
("nestedObject { unexpectedAttributeErrorField }", AttributeError),
("nestedObject { unexpectedKeyErrorField }", KeyError),
("nestedObjectError { __typename }", TypeError),
],
)
def test_unexpected_error(self, field, exception, schema):
with raises(exception):
# no result, but the exception should be propagated
> schema.execute(
f"query {{ {field} }}",
execution_context_class=UnforgivingExecutionContext,
)
E Failed: DID NOT RAISE

graphene/types/tests/test_schema.py:180: Failed
============================= SnapshotTest summary =============================
21 snapshots passed.
=========================== short test summary info ============================
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[unexpectedValueErrorField-ValueError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[unexpectedTypeErrorField-TypeError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[unexpectedAttributeErrorField-AttributeError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[unexpectedKeyErrorField-KeyError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[nestedObject { unexpectedValueErrorField }-ValueError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[nestedObject { unexpectedTypeErrorField }-TypeError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[nestedObject { unexpectedAttributeErrorField }-AttributeError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[nestedObject { unexpectedKeyErrorField }-KeyError]
FAILED graphene/types/tests/test_schema.py::TestUnforgivingExecutionContext::test_unexpected_error[nestedObjectError { __typename }-TypeError]
======================== 9 failed, 380 passed in 3.56s =========================

```

* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
a github repo, https://repl.it or similar.

* **What is the expected behavior?**

Tests should complete.

* **What is the motivation / use case for changing the behavior?**

n/a

* **Please tell us about your environment:**

- Version:
- graphene 3.0b7
- Dependencies:
- graphql-core 3.1.5
- graphql-relay 3.1.0
- aniso8601
- Platform: Linux
- Test dependencies:
- Python 3.9.5
- pytest-6.2.4
- py-1.10.0
- pluggy-0.13.1
- pytest-asyncio-0.15.1
- pytest-benchmark-3.2.2
- pytest-mock-3.6.1
- snapshottest-0.6.0

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

Reproducible with python 3.7, 3.8 and 3.9.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by running TestUnforgivingExecutionContext.test_unexpected_error in graphene/types/tests/test_schema.py with the reported environment. Trace the schema.execute call using execution_context_class=UnforgivingExecutionContext and compare the expected exception propagation for the listed fields. Done means the test passes for each listed exception and nested query.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
graphql, python
Área
backend-api-design, testing-qa
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.