aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Alexander <tlalexander@gmail.com>2018-12-05 10:34:50 -0800
committerPatrick <pnpnpn@users.noreply.github.com>2018-12-05 13:34:50 -0500
commit3c4bad7f66e1109ccdcb79c2cb62cd669b7666d8 (patch)
tree2963c370414e905fc47634a80227163bc02948a3
parent3ad0308d30c4904b9ea272da326c0c3795161378 (diff)
downloadtimeout-decorator-3c4bad7f66e1109ccdcb79c2cb62cd669b7666d8.tar.gz
Fix a bug when using a custom exception with a custom exception message. Also remove tests for Python 3.2 and 3.3. (#55)
* Fix a bug in the code when using a custom exception with a custom exception message. Added a test for this condition. * Fix line spacing lint error. * Update CI config to remove Python 3.2 and 3.3, which are no longer supported by tox. * Remove python 3.2 and 3.3 from travis config. * Bump version number to 0.4.1. * Also update version number in init file to 0.4.1.
-rw-r--r--.travis.yml3
-rw-r--r--setup.py2
-rw-r--r--tests/test_timeout_decorator.py8
-rw-r--r--timeout_decorator/__init__.py2
-rw-r--r--timeout_decorator/timeout_decorator.py2
-rw-r--r--tox.ini4
6 files changed, 13 insertions, 8 deletions
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 @@ long_description = (
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 test_timeout_custom_exception_message():
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 timeout
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]