Skip to content

Commit

Permalink
Inherit TimeoutError from TimeoutError
Browse files Browse the repository at this point in the history
  • Loading branch information
ei-grad committed Mar 28, 2020
1 parent 5f7c679 commit d91fe7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Usage
-----

```python
from kill_timeout import kill_timeout, TimeoutError
from kill_timeout import kill_timeout


limit_in_seconds = 5
Expand Down
7 changes: 6 additions & 1 deletion kill_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
from tblib.decorators import return_error, Error


class TimeoutError(Exception):
class TimeoutError(TimeoutError):
"""Custom TimeoutError
To distinguish from TimeoutError's raised by functions wrapped in
kill_timeout decorator.
"""
pass


Expand Down
4 changes: 3 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from kill_timeout import kill_timeout, TimeoutError
from kill_timeout import kill_timeout, TimeoutError as KillTimeoutError


@kill_timeout(0.1)
Expand All @@ -17,6 +17,8 @@ def test_simple():


def test_timeout():
with pytest.raises(KillTimeoutError):
f(0.2)
with pytest.raises(TimeoutError):
f(0.2)

Expand Down

0 comments on commit d91fe7a

Please sign in to comment.