diff --git a/examples/miniapps/fastapi-redis/fastapiredis/tests.py b/examples/miniapps/fastapi-redis/fastapiredis/tests.py index bde075ab..7d31a99d 100644 --- a/examples/miniapps/fastapi-redis/fastapiredis/tests.py +++ b/examples/miniapps/fastapi-redis/fastapiredis/tests.py @@ -3,7 +3,7 @@ from unittest import mock import pytest -from httpx import AsyncClient +from httpx import ASGITransport, AsyncClient from .application import app, container from .services import Service @@ -11,7 +11,10 @@ from .services import Service @pytest.fixture def client(event_loop): - client = AsyncClient(app=app, base_url="http://test") + client = AsyncClient( + transport=ASGITransport(app=app), + base_url="http://test", + ) yield client event_loop.run_until_complete(client.aclose()) diff --git a/examples/miniapps/fastapi-simple/tests.py b/examples/miniapps/fastapi-simple/tests.py index 4d80e072..cf033592 100644 --- a/examples/miniapps/fastapi-simple/tests.py +++ b/examples/miniapps/fastapi-simple/tests.py @@ -1,14 +1,17 @@ from unittest import mock import pytest -from httpx import AsyncClient +from httpx import ASGITransport, AsyncClient from fastapi_di_example import app, container, Service @pytest.fixture async def client(event_loop): - async with AsyncClient(app=app, base_url="http://test") as client: + async with AsyncClient( + transport=ASGITransport(app=app), + base_url="http://test", + ) as client: yield client diff --git a/examples/miniapps/fastapi/giphynavigator/tests.py b/examples/miniapps/fastapi/giphynavigator/tests.py index 2b57d50d..c1505e78 100644 --- a/examples/miniapps/fastapi/giphynavigator/tests.py +++ b/examples/miniapps/fastapi/giphynavigator/tests.py @@ -3,7 +3,7 @@ from unittest import mock import pytest -from httpx import AsyncClient +from httpx import ASGITransport, AsyncClient from giphynavigator.application import app from giphynavigator.giphy import GiphyClient @@ -11,7 +11,10 @@ from giphynavigator.giphy import GiphyClient @pytest.fixture async def client(): - async with AsyncClient(app=app, base_url="http://test") as client: + async with AsyncClient( + transport=ASGITransport(app=app), + base_url="http://test", + ) as client: yield client diff --git a/tests/unit/wiring/test_fastapi_py36.py b/tests/unit/wiring/test_fastapi_py36.py index 4615b221..1e9ff584 100644 --- a/tests/unit/wiring/test_fastapi_py36.py +++ b/tests/unit/wiring/test_fastapi_py36.py @@ -1,4 +1,4 @@ -from httpx import AsyncClient +from httpx import ASGITransport, AsyncClient from pytest import fixture, mark from pytest_asyncio import fixture as aio_fixture @@ -19,7 +19,7 @@ from wiringfastapi import web @aio_fixture async def async_client(): - client = AsyncClient(app=web.app, base_url="http://test") + client = AsyncClient(transport=ASGITransport(app=web.app), base_url="http://test") yield client await client.aclose()