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 details)
File details
Details for the file duration_check-1.0.4.tar.gz
.
File metadata
- Download URL: duration_check-1.0.4.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2584b1b3c33d03d8cf16088bb43a6cc7f96ade356bd01367b9545bf4beced76b |
|
MD5 | f73e6a772b6b8a3cee92786149a9b1a3 |
|
BLAKE2b-256 | f4556301eacbd98d63b2054ae04155b5c740c0120f9a83c4d681e312c25d0086 |