Skip to content

Commit f7981e4

Browse files
committed
add catch_exceptions timeout test
1 parent 9394da8 commit f7981e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/utils/test_exception_handling.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ async def error() -> None:
4242
logger_error_spy.assert_called_once_with("error function timed out")
4343

4444

45+
async def test_catch_exceptions_timeout_no_message(caplog):
46+
"""'catch_exceptions' should not log any message if a 'TimeoutError' exception is raised and
47+
no timeout message is provided"""
48+
with catch_exceptions():
49+
await asyncio.wait_for(asyncio.sleep(0.1), timeout=0.01)
50+
51+
assert_message_not_in_log(caplog, "Exception caught successfully, going on")
52+
assert_message_not_in_log(caplog, "TimeoutError")
53+
54+
4555
async def test_catch_exceptions_base_exception(caplog):
4656
"""'catch_exceptions' should log the exception message if an exception inherited from
4757
'BaseSentinelaException' is raised"""

0 commit comments

Comments
 (0)