Linux-only Pytest plugin to control durations of various test case execution phases.
For documentation visit pytest-timeouts.readthedocs.io.
This plugin has been designed for specific use cases which are out of the scope of famous pytest-timeout plugin.
It uses a SIGALRM signal to schedule a timer which breaks the test case.
setup,executionandteardownphase timeouts controllable by:- opts:
--setup-timeout,--execution-timeoutand--teardown-timeout - ini:
setup_timeout,execution_timeoutandteardown_timeout - mark:
setup_timeout,execution_timeoutandteardown_timeout
- opts:
- fixed order of timeout settings: opts > markers > ini, controlled by
--timeouts-order --timeouts-orderallow change order of override timeout settings, and disable some settings, i.e.--timeout-order idisable markers and opts, any combination is allow- timeout disabled when debugging with PDB
pip install pytest-timeoutspip install git+https://github.com/Scony/pytest-timeouts.gitpytest --setup-timeout 2.5 --execution-timeout 2.01 --teardown-timeout 0[pytest]
setup_timeout = 2.5
execution_timeout = 2.01
teardown_timeout = 0import time
import pytest
@pytest.mark.setup_timeout(0.3)
@pytest.mark.execution_timeout(0.5)
@pytest.mark.teardown_timeout(0.4)
def test_timeout():
time.sleep(1)- Pawel Lampe
- Kamil Luczak