1+ from __future__ import annotations
2+
3+ from collections .abc import AsyncGenerator
14from contextlib import suppress
25
36import pytest
@@ -37,7 +40,7 @@ async def _test_isolation_level_read_only(
3740 await connection .rollback ()
3841
3942 async with connection .cursor () as cursor :
40- cursor .execute ("DROP TABLE foo" )
43+ await cursor .execute ("DROP TABLE foo" )
4144
4245 async def _test_connection (self , connection : dbapi .Connection ) -> None :
4346 await connection .commit ()
@@ -66,7 +69,9 @@ async def _test_connection(self, connection: dbapi.Connection) -> None:
6669 await cur .execute ("DROP TABLE foo" )
6770 await cur .close ()
6871
69- async def _test_cursor_raw_query (self , connection : dbapi .Connection ) -> None :
72+ async def _test_cursor_raw_query (
73+ self , connection : dbapi .Connection
74+ ) -> None :
7075 cur = connection .cursor ()
7176 assert cur
7277
@@ -107,7 +112,10 @@ async def _test_cursor_raw_query(self, connection: dbapi.Connection) -> None:
107112
108113 async def _test_errors (self , connection : dbapi .Connection ) -> None :
109114 with pytest .raises (dbapi .InterfaceError ):
110- await dbapi .connect ("localhost:2136" , database = "/local666" )
115+ await dbapi .connect (
116+ "localhost:2136" , # type: ignore
117+ database = "/local666" , # type: ignore
118+ )
111119
112120 cur = connection .cursor ()
113121
@@ -142,8 +150,10 @@ async def _test_errors(self, connection: dbapi.Connection) -> None:
142150
143151class TestAsyncConnection (BaseDBApiTestSuit ):
144152 @pytest_asyncio .fixture
145- async def connection (self , connection_kwargs ):
146- conn = await dbapi .connect (** connection_kwargs )
153+ async def connection (
154+ self , connection_kwargs : dict
155+ ) -> AsyncGenerator [dbapi .Connection ]:
156+ conn = await dbapi .connect (** connection_kwargs ) # ignore: typing
147157 try :
148158 yield conn
149159 finally :
@@ -166,19 +176,21 @@ async def test_isolation_level_read_only(
166176 isolation_level : str ,
167177 read_only : bool ,
168178 connection : dbapi .Connection ,
169- ):
179+ ) -> None :
170180 await self ._test_isolation_level_read_only (
171181 connection , isolation_level , read_only
172182 )
173183
174184 @pytest .mark .asyncio
175- async def test_connection (self , connection : dbapi .Connection ):
185+ async def test_connection (self , connection : dbapi .Connection ) -> None :
176186 await self ._test_connection (connection )
177187
178188 @pytest .mark .asyncio
179- async def test_cursor_raw_query (self , connection : dbapi .Connection ):
189+ async def test_cursor_raw_query (
190+ self , connection : dbapi .Connection
191+ ) -> None :
180192 await self ._test_cursor_raw_query (connection )
181193
182194 @pytest .mark .asyncio
183- async def test_errors (self , connection : dbapi .Connection ):
195+ async def test_errors (self , connection : dbapi .Connection ) -> None :
184196 await self ._test_errors (connection )
0 commit comments