This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,4 @@ __pycache__/
88* .egg-info /
99htmlcov /
1010venv /
11+ .idea /
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ async def __aenter__(self) -> "Connection":
251251 try :
252252 if self ._connection_counter == 1 :
253253 await self ._connection .acquire ()
254- except Exception as e :
254+ except BaseException as e :
255255 self ._connection_counter -= 1
256256 raise e
257257 return self
Original file line number Diff line number Diff line change @@ -303,24 +303,22 @@ async def test_ddl_queries(database_url):
303303 await database .execute (query )
304304
305305
306+ @pytest .mark .parametrize ("exception" , [Exception , asyncio .CancelledError ])
306307@pytest .mark .parametrize ("database_url" , DATABASE_URLS )
307308@mysql_versions
308309@async_adapter
309- async def test_queries_after_error (database_url ):
310+ async def test_queries_after_error (database_url , exception ):
310311 """
311312 Test that the basic `execute()` works after a previous error.
312313 """
313314
314- class DBException (Exception ):
315- pass
316-
317315 async with Database (database_url ) as database :
318316 with patch .object (
319317 database .connection ()._connection ,
320318 "acquire" ,
321- new = AsyncMock (side_effect = DBException ),
319+ new = AsyncMock (side_effect = exception ),
322320 ):
323- with pytest .raises (DBException ):
321+ with pytest .raises (exception ):
324322 query = notes .select ()
325323 await database .fetch_all (query )
326324
You can’t perform that action at this time.
0 commit comments