Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASGI app broken with asyncio #142

Closed
patrick91 opened this issue Sep 6, 2019 · 0 comments · Fixed by #183
Closed

ASGI app broken with asyncio #142

patrick91 opened this issue Sep 6, 2019 · 0 comments · Fixed by #183
Labels
bug Something isn't working dev-server Hacktoberfest help wanted Extra attention is needed

Comments

@patrick91
Copy link
Member

patrick91 commented Sep 6, 2019

Our ASGI app is currently broken with async io stuff. The implementation I made needs a bit of love :) We might have a look at how Ariadne is doing this :)

Here's a test that fails:

import typing

import pytest

import strawberry
from starlette.testclient import TestClient
from strawberry.asgi import GraphQL


@pytest.fixture
def async_schema():
    @strawberry.type
    class Query:
        @strawberry.field
        async def hello(self, info, name: typing.Optional[str] = None) -> str:
            return f"Hello {name or 'world'}"

    return strawberry.Schema(Query)


@pytest.fixture
def test_client(async_schema):
    app = GraphQL(async_schema)

    return TestClient(app)


def test_simple_query(schema, test_client):
    response = test_client.post("/", json={"query": "{ hello }"})

    assert response.json() == {"data": {"hello": "Hello world"}}
@patrick91 patrick91 added bug Something isn't working help wanted Extra attention is needed dev-server labels Sep 6, 2019
jgosmann added a commit to jgosmann/strawberry that referenced this issue Oct 14, 2019
patrick91 pushed a commit that referenced this issue Oct 14, 2019
* Fix execution of async resolvers.

Fixes #142.

* Add RELEASE.md

* Silence type checker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev-server Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant