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__/
8
8
* .egg-info /
9
9
htmlcov /
10
10
venv /
11
+ .idea /
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ async def __aenter__(self) -> "Connection":
251
251
try :
252
252
if self ._connection_counter == 1 :
253
253
await self ._connection .acquire ()
254
- except Exception as e :
254
+ except BaseException as e :
255
255
self ._connection_counter -= 1
256
256
raise e
257
257
return self
Original file line number Diff line number Diff line change @@ -303,24 +303,22 @@ async def test_ddl_queries(database_url):
303
303
await database .execute (query )
304
304
305
305
306
+ @pytest .mark .parametrize ("exception" , [Exception , asyncio .CancelledError ])
306
307
@pytest .mark .parametrize ("database_url" , DATABASE_URLS )
307
308
@mysql_versions
308
309
@async_adapter
309
- async def test_queries_after_error (database_url ):
310
+ async def test_queries_after_error (database_url , exception ):
310
311
"""
311
312
Test that the basic `execute()` works after a previous error.
312
313
"""
313
314
314
- class DBException (Exception ):
315
- pass
316
-
317
315
async with Database (database_url ) as database :
318
316
with patch .object (
319
317
database .connection ()._connection ,
320
318
"acquire" ,
321
- new = AsyncMock (side_effect = DBException ),
319
+ new = AsyncMock (side_effect = exception ),
322
320
):
323
- with pytest .raises (DBException ):
321
+ with pytest .raises (exception ):
324
322
query = notes .select ()
325
323
await database .fetch_all (query )
326
324
You can’t perform that action at this time.
0 commit comments