From 1891952dc41c5da75e3e3542748c1b283d752f6b Mon Sep 17 00:00:00 2001 From: ZipFile Date: Tue, 13 Aug 2024 10:55:33 +0000 Subject: [PATCH] Fix asyncio tests --- tests/unit/ext/test_aiohttp_py35.py | 3 ++- tests/unit/wiring/test_fastapi_py36.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/ext/test_aiohttp_py35.py b/tests/unit/ext/test_aiohttp_py35.py index d4fcfc20..698acf85 100644 --- a/tests/unit/ext/test_aiohttp_py35.py +++ b/tests/unit/ext/test_aiohttp_py35.py @@ -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 diff --git a/tests/unit/wiring/test_fastapi_py36.py b/tests/unit/wiring/test_fastapi_py36.py index d93cc9c2..4615b221 100644 --- a/tests/unit/wiring/test_fastapi_py36.py +++ b/tests/unit/wiring/test_fastapi_py36.py @@ -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