Skip to content

TestUnforgivinExeuctionContext.test_unexpected_error fails #1346

Open
@mweinelt

Description

@mweinelt

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 = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff54de550>
field = 'unexpectedValueErrorField', exception = <class 'ValueError'>
schema = <graphene.types.schema.Schema object at 0x7ffff54df550>

    @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 <class 'ValueError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff54df160>
field = 'unexpectedTypeErrorField', exception = <class 'TypeError'>
schema = <graphene.types.schema.Schema object at 0x7ffff4d30490>

    @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 <class 'TypeError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff5953d00>
field = 'unexpectedAttributeErrorField', exception = <class 'AttributeError'>
schema = <graphene.types.schema.Schema object at 0x7ffff573c520>

    @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 <class 'AttributeError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff4d30880>
field = 'unexpectedKeyErrorField', exception = <class 'KeyError'>
schema = <graphene.types.schema.Schema object at 0x7ffff4d30040>

    @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 <class 'KeyError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff5a19a90>
field = 'nestedObject { unexpectedValueErrorField }'
exception = <class 'ValueError'>
schema = <graphene.types.schema.Schema object at 0x7ffff59f1400>

    @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 <class 'ValueError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff4d361f0>
field = 'nestedObject { unexpectedTypeErrorField }'
exception = <class 'TypeError'>
schema = <graphene.types.schema.Schema object at 0x7ffff59f4250>

    @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 <class 'TypeError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff56ef430>
field = 'nestedObject { unexpectedAttributeErrorField }'
exception = <class 'AttributeError'>
schema = <graphene.types.schema.Schema object at 0x7ffff56ef7f0>

    @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 <class 'AttributeError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff59e39d0>
field = 'nestedObject { unexpectedKeyErrorField }'
exception = <class 'KeyError'>
schema = <graphene.types.schema.Schema object at 0x7ffff5630be0>

    @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 <class 'KeyError'>

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

self = <graphene.types.tests.test_schema.TestUnforgivingExecutionContext object at 0x7ffff5a677c0>
field = 'nestedObjectError { __typename }', exception = <class 'TypeError'>
schema = <graphene.types.schema.Schema object at 0x7ffff595ce50>

    @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 <class 'TypeError'>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions