Version 4.0.0

This commit is contained in:
Tim Savannah 2017-05-19 20:49:45 -04:00
parent 1f4e536784
commit 906f2b9028
3 changed files with 9 additions and 8 deletions

View File

@ -6,8 +6,8 @@
'''
__version__ = '3.1.0'
__version_tuple__ = (3, 1, 0)
__version__ = '4.0.0'
__version_tuple__ = (4, 0, 0)
__all__ = ('func_timeout', 'set_timeout', 'FunctionTimedOut')

View File

@ -30,7 +30,7 @@ if __name__ == '__main__':
log_description = summary
setup(name='func_timeout',
version='3.1.0',
version='4.0.0',
packages=['func_timeout'],
author='Tim Savannah',
author_email='kata198@gmail.com',

View File

@ -1,22 +1,23 @@
#!/usr/bin/env python
from func_timeout import func_timeout, FunctionTimedOut
from func_timeout import func_timeout, set_timeout, FunctionTimedOut
import time
import sys
@set_timeout(2.5)
def doit(howmany):
time.sleep(2)
time.sleep(3)
return 17 + howmany
if __name__ == '__main__':
print ( "Should get return value of 23:" )
print ( "\tGot Return: %s\n" %(str(func_timeout(4, doit, args=(6,))),) )
# print ( "\tGot Return: %s\n" %(str(func_timeout(4, doit, args=(6,))),) )
print ( "\nShould time out (exception):" )
try:
print ("\tGot Return: %s\n" %(str(func_timeout(1, doit, kwargs={'howmany' : 16})),))
print ( "\tGot Return: %s\n", str(doit(16)) )
# print ("\tGot Return: %s\n" %(str(func_timeout(4, doit, kwargs={'howmany' : 16})),))
except FunctionTimedOut as e:
sys.stderr.write('\tGot Exception: %s\n' %(str(e),))
pass