Skip to content

Commit

Permalink
Fix imports for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorJohn committed Oct 7, 2024
1 parent f5c5c87 commit 3697f8f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
from typing import TYPE_CHECKING, AsyncGenerator

import pytest
from django.test.client import Client
from starlette.testclient import TestClient as AsgiTestClient

import aiohttp.web
from aiohttp.test_utils import TestClient as AiohttpTestClient
from aiohttp.test_utils import TestServer
from strawberry.aiohttp.test import GraphQLTestClient as AiohttpGraphQLTestClient
from strawberry.aiohttp.views import GraphQLView
from strawberry.asgi import GraphQL
Expand All @@ -23,21 +18,28 @@

@asynccontextmanager
async def aiohttp_graphql_client() -> AsyncGenerator[AiohttpGraphQLTestClient]:
from aiohttp import web
from aiohttp.test_utils import TestClient, TestServer

view = GraphQLView(schema=schema)
app = aiohttp.web.Application()
app = web.Application()
app.router.add_route("*", "/graphql/", view)

async with AiohttpTestClient(TestServer(app)) as client:
async with TestClient(TestServer(app)) as client:
yield AiohttpGraphQLTestClient(client)


@asynccontextmanager
async def asgi_graphql_client() -> AsyncGenerator[AsgiGraphQLTestClient]:
yield AsgiGraphQLTestClient(AsgiTestClient(GraphQL(schema)))
from starlette.testclient import TestClient

yield AsgiGraphQLTestClient(TestClient(GraphQL(schema)))


@asynccontextmanager
async def django_graphql_client() -> AsyncGenerator[DjangoGraphQLTestClient]:
from django.test.client import Client

yield DjangoGraphQLTestClient(Client())


Expand Down

0 comments on commit 3697f8f

Please sign in to comment.