File tree Expand file tree Collapse file tree 5 files changed +12
-21
lines changed
Expand file tree Collapse file tree 5 files changed +12
-21
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,13 @@ dependencies = [
1111 " mkdoc>=0.1" ,
1212 " mkdocs-material>=9.5.48" ,
1313 " pytest>=8.3.4" ,
14- " pytest-asyncio>=0.24.0" ,
1514 " ruff>=0.8.2" ,
1615 " sqlalchemy>=2.0.36" ,
1716 " testcontainers>=4.8.2" ,
1817]
1918
2019[tool .pytest .ini_options ]
2120pythonpath = ' .'
22- asyncio_mode = ' auto'
2321
2422[tool .ruff ]
2523line-length = 79
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ aiosqlite>=0.20.0
22asyncpg >= 0.30.0
33fastapi [standard ]>= 0.115.6
44pytest >= 8.3.4
5- pytest-asyncio >= 0.24.0
65ruff >= 0.8.2
76sqlalchemy >= 2.0.36
87testcontainers >= 4.8.2
Original file line number Diff line number Diff line change 1- import pytest_asyncio
1+ import pytest
22from httpx import ASGITransport , AsyncClient
33from sqlalchemy .ext .asyncio import (
44 AsyncSession ,
1212from src .models import table_register
1313
1414
15- @pytest_asyncio .fixture (scope = 'session' )
15+ @pytest .fixture
16+ def anyio_backend ():
17+ return 'asyncio'
18+
19+
20+ @pytest .fixture (scope = 'session' )
1621def postgres_container ():
1722 with PostgresContainer ('postgres:16' , driver = 'asyncpg' ) as postgres :
1823 yield postgres
1924
2025
21- @pytest_asyncio .fixture
26+ @pytest .fixture
2227async def async_session (postgres_container : PostgresContainer ):
2328 async_db_url = postgres_container .get_connection_url ()
2429 async_engine = create_async_engine (async_db_url , pool_pre_ping = True )
@@ -40,7 +45,7 @@ async def async_session(postgres_container: PostgresContainer):
4045 await async_engine .dispose ()
4146
4247
43- @pytest_asyncio .fixture
48+ @pytest .fixture
4449async def async_client (async_session : async_sessionmaker [AsyncSession ]):
4550 app .dependency_overrides [get_session ] = lambda : async_session
4651 _transport = ASGITransport (app = app )
Original file line number Diff line number Diff line change 11from http import HTTPStatus
22
3+ import pytest
34from httpx import AsyncClient
45from sqlalchemy .ext .asyncio import AsyncSession
56
67from src .models import Ticket
78
9+ pytestmark = pytest .mark .anyio
10+
811
912async def test_get_all_tickets_success (
1013 async_session : AsyncSession , async_client : AsyncClient
You can’t perform that action at this time.
0 commit comments