22from typing import cast
33
44import pytest
5- import pytest_asyncio
65from aiohttp import BasicAuth , ClientSession , web
76from yarl import URL
87
@@ -19,10 +18,10 @@ async def start_app(aiohttp_client):
1918 return app
2019
2120
22- @pytest .fixture ()
23- def client (event_loop , aiohttp_client ):
21+ @pytest .fixture
22+ async def client (aiohttp_client ):
2423 """Instance of app's server and client"""
25- return event_loop . run_until_complete ( start_app (aiohttp_client ) )
24+ return await start_app (aiohttp_client )
2625
2726
2827class AidboxSession (ClientSession ):
@@ -40,7 +39,7 @@ async def _request(self, method, path, *args, **kwargs):
4039 return await super ()._request (method , url , * args , ** kwargs )
4140
4241
43- @pytest_asyncio .fixture
42+ @pytest .fixture
4443async def aidbox (client ):
4544 """HTTP client for making requests to Aidbox"""
4645 app = cast (web .Application , client .server .app )
@@ -53,7 +52,7 @@ async def aidbox(client):
5352 await session .close ()
5453
5554
56- @pytest_asyncio .fixture
55+ @pytest .fixture
5756async def safe_db (aidbox , client , sdk ):
5857 resp = await aidbox .post (
5958 "/$psql" ,
@@ -75,16 +74,16 @@ async def safe_db(aidbox, client, sdk):
7574 )
7675
7776
78- @pytest .fixture ()
77+ @pytest .fixture
7978def sdk (client ):
8079 return cast (web .Application , client .server .app )[ak .sdk ]
8180
8281
83- @pytest .fixture ()
82+ @pytest .fixture
8483def aidbox_client (client ):
8584 return cast (web .Application , client .server .app )[ak .client ]
8685
8786
88- @pytest .fixture ()
87+ @pytest .fixture
8988def aidbox_db (client ):
9089 return cast (web .Application , client .server .app )[ak .db ]
0 commit comments