diff --git a/.travis.yml b/.travis.yml index 5cd4bb7..fc069f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,10 @@ sudo: false python: - '2.6' - '2.7' -- '3.2' -- '3.3' - '3.4' - '3.5' - '3.6' install: -- if [[ $TRAVIS_PYTHON_VERSION == 3.2 ]]; then pip install -U "virtualenv<14.0.0"; fi - pip install python-coveralls tox tox-travis script: tox --recreate after_success: diff --git a/setup.py b/setup.py index e001557..3d6fbb7 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( name='timeout-decorator', - version='0.4.0', + version='0.4.1', description='Timeout decorator', long_description=long_description, author='Patrick Ng', diff --git a/tests/test_timeout_decorator.py b/tests/test_timeout_decorator.py index 536bc8f..fad4d81 100644 --- a/tests/test_timeout_decorator.py +++ b/tests/test_timeout_decorator.py @@ -96,6 +96,14 @@ def f(): f() +def test_timeout_custom_exception_with_message(): + @timeout(seconds=1, timeout_exception=RuntimeError, exception_message="Custom fail message") + def f(): + time.sleep(2) + with pytest.raises(RuntimeError, match="Custom fail message"): + f() + + def test_timeout_default_exception_message(): @timeout(seconds=1) def f(): diff --git a/timeout_decorator/__init__.py b/timeout_decorator/__init__.py index c802c55..8c89b0d 100644 --- a/timeout_decorator/__init__.py +++ b/timeout_decorator/__init__.py @@ -4,4 +4,4 @@ from .timeout_decorator import TimeoutError __title__ = 'timeout_decorator' -__version__ = '0.4.0' +__version__ = '0.4.1' diff --git a/timeout_decorator/timeout_decorator.py b/timeout_decorator/timeout_decorator.py index f05da0f..2b3121d 100644 --- a/timeout_decorator/timeout_decorator.py +++ b/timeout_decorator/timeout_decorator.py @@ -44,7 +44,7 @@ def _raise_exception(exception, exception_message): if exception_message is None: raise exception() else: - raise exception(value=exception_message) + raise exception(exception_message) def timeout(seconds=None, use_signals=True, timeout_exception=TimeoutError, exception_message=None): diff --git a/tox.ini b/tox.ini index 9ba30b9..d66c3f5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] distshare={homedir}/.tox/distshare -envlist=py{26,27,32,33,34,35,36} +envlist=py{26,27,34,35,36} skip_missing_interpreters=true indexserver= pypi = https://pypi.python.org/simple @@ -10,7 +10,7 @@ commands= py.test timeout_decorator tests --pep8 deps = py32: pytest<3.0 - py{26,27,33,34,35,36}: pytest>=3.0 + py{26,27,34,35,36}: pytest>=3.0 pytest-pep8==1.0.6 [pytest]