graphql-python / graphql-python/graphene
TestUnforgivinExeuctionContext.test_unexpected_error fails
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 818
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
**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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy TestUnforgivingExecutionContext.test_unexpected_error trong graphene/types/tests/test_schema.py với môi trường được báo cáo. Theo dõi lệnh gọi schema.execute bằng cách sử dụng execution_context_class=UnforgivingExecutionContext và so sánh việc lan truyền ngoại lệ được mong đợi đối với các trường đã liệt kê. Hoàn thành khi kiểm thử vượt qua với từng ngoại lệ và truy vấn lồng nhau đã liệt kê.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- graphql, python
- Lĩnh vực
- backend-api-design, testing-qa
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 38/100