Fix asyncio tests

This commit is contained in:
ZipFile 2024-08-13 10:55:33 +00:00
parent 2c998b8448
commit 1891952dc4
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ from aiohttp import web, test_utils
from dependency_injector import containers, providers
from dependency_injector.ext import aiohttp
from pytest import fixture, mark
from pytest_asyncio import fixture as aio_fixture
async def index_view(_):
@ -63,7 +64,7 @@ def app():
return app
@fixture
@aio_fixture
async def client(app):
async with test_utils.TestClient(test_utils.TestServer(app)) as client:
yield client

View File

@ -1,5 +1,6 @@
from httpx import AsyncClient
from pytest import fixture, mark
from pytest_asyncio import fixture as aio_fixture
# Runtime import to avoid syntax errors in samples on Python < 3.5 and reach top-dir
import os
@ -16,7 +17,7 @@ sys.path.append(_SAMPLES_DIR)
from wiringfastapi import web
@fixture
@aio_fixture
async def async_client():
client = AsyncClient(app=web.app, base_url="http://test")
yield client