graphql-python / graphql-python/graphene
TestUnforgivinExeuctionContext.test_unexpected_error fails
- Langage dominant
- Python
- Étoiles
- 8.2k
- Forks
- 818
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**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.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par exécuter TestUnforgivingExecutionContext.test_unexpected_error dans graphene/types/tests/test_schema.py avec l’environnement indiqué. Suivez l’appel à schema.execute en utilisant execution_context_class=UnforgivingExecutionContext et comparez la propagation attendue des exceptions pour les champs indiqués. C’est terminé lorsque le test réussit pour chaque exception et requête imbriquée indiquées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- graphql, python
- Domaine
- backend-api-design, testing-qa
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 38/100