Skip to content

Commit b63c8f6

Browse files
committed
Do not use bare except
1 parent 6027f2e commit b63c8f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sqlalchemy_bind_manager/_transaction_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __del__(self):
8080
loop.create_task(self._session_class.remove())
8181
else:
8282
loop.run_until_complete(self._session_class.remove())
83-
except:
83+
except RuntimeError:
8484
asyncio.run(self._session_class.remove())
8585

8686
@asynccontextmanager

tests/transaction_handler/async_/test_session_lifecycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_session_is_destroyed_on_cleanup_if_loop_is_not_running(sa_manager):
3131
"remove",
3232
wraps=original_session_close,
3333
) as mocked_close, patch(
34-
"asyncio.get_event_loop", side_effect=Exception()
34+
"asyncio.get_event_loop", side_effect=RuntimeError()
3535
) as mocked_get_event_loop:
3636
# This should trigger the garbage collector and close the session
3737
uow = None

0 commit comments

Comments
 (0)