File tree Expand file tree Collapse file tree
{{cookiecutter.project_slug}} Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,18 +21,20 @@ dependencies = [
2121[dependency-groups ]
2222dev = [
2323 " asgi-lifespan" ,
24- " alt-pytest-asyncio" ,
2524 " httpx[cli,http2]" ,
2625 " mypy" ,
2726 " pip-audit" ,
2827 " pytest" ,
28+ " pytest-asyncio" ,
2929 " pytest-cov" ,
3030 " ruff" ,
3131]
3232
3333[tool .pytest .ini_options ]
34+ asyncio_mode = " auto"
35+ asyncio_default_test_loop_scope = " session"
36+ asyncio_default_fixture_loop_scope = " session"
3437filterwarnings = [" ignore::DeprecationWarning" ]
35- default_async_timeout = 600
3638
3739[tool .mypy ]
3840ignore_missing_imports = true
Original file line number Diff line number Diff line change 33
44from asgi_lifespan import LifespanManager
55from fastapi import FastAPI
6- from httpx import AsyncClient
6+ from httpx import ASGITransport , AsyncClient
77from pytest import fixture
88
99os .environ ['ENV' ] = 'testing'
@@ -22,5 +22,5 @@ async def app() -> AsyncIterable[FastAPI]:
2222
2323@fixture
2424async def client (app : FastAPI ) -> AsyncIterable [AsyncClient ]:
25- async with AsyncClient (app = app , base_url = 'http://testserver' ) as client :
25+ async with AsyncClient (transport = ASGITransport ( app = app ) , base_url = 'http://testserver' ) as client :
2626 yield client
Original file line number Diff line number Diff line change 22from collections .abc import AsyncIterable
33
44from fastapi import APIRouter , FastAPI , status
5- from httpx import AsyncClient
5+ from httpx import ASGITransport , AsyncClient
66from pytest import CaptureFixture , fixture
77
88basic_log_fields = {
@@ -50,7 +50,7 @@ async def divide(a: int, b: int) -> float:
5050
5151 init_loguru ()
5252
53- async with AsyncClient (app = app , base_url = 'http://test_logging' ) as client :
53+ async with AsyncClient (transport = ASGITransport ( app = app ) , base_url = 'http://test_logging' ) as client :
5454 yield client
5555
5656 return
You can’t perform that action at this time.
0 commit comments