Timeout and Duration decorator for python unittest.Testcase
Project description
Duration Check
Working python decorators to check how long function can take to be executed.
Decorator available
timeout
viatimeout_decorator_builder()
duration
Code example
import sys
import unittest
from duration_check import timeout_decorator_builder
# This CAN NOT be a lambda function because we can't pickle them
def module_getter():
return sys.modules[__name__]
timeout = timeout_decorator_builder(module_getter) # This CAN NOT be a lambda function because we can't pickle them
class SuperTaskUnitTest(unittest.TestCase):
@timeout(2)
def test_timeout_super_task(self):
self.assertTrue(my_super_task())
Issues/Bug report or improvement ideas
https://gitlab.com/devolive/pypi-packages/duration-check/-/issues
License
GNU Lesser General Public License v3 or later (LGPLv3+)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
duration_check-1.0.4.tar.gz
(5.8 kB
view hashes)