diff options
Diffstat (limited to 'tests/test_timeout_decorator.py')
-rw-r--r-- | tests/test_timeout_decorator.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_timeout_decorator.py b/tests/test_timeout_decorator.py index d1a0efd..be6e314 100644 --- a/tests/test_timeout_decorator.py +++ b/tests/test_timeout_decorator.py @@ -86,3 +86,18 @@ def test_timeout_pickle_error(): return Test() with pytest.raises(TimeoutError): f() + +def test_timeout_custom_exception_message(): + message = "Custom fail message" + @timeout(seconds=1, exception_message=message) + def f(): + time.sleep(2) + with pytest.raises(TimeoutError, match=message): + f() + +def test_timeout_default_exception_message(): + @timeout(seconds=1) + def f(): + time.sleep(2) + with pytest.raises(TimeoutError, match="Timed Out"): + f() |