Linux-only Pytest plugin to control durations of various test case execution phases
Project description
# pytest-timeouts
[](https://travis-ci.org/Scony/pytest-timeouts)
[](https://pytest-timeouts.readthedocs.io/en/latest/?badge=latest)




Linux-only Pytest plugin to control durations of various test case execution phases.
## Documentation
For documentation visit [pytest-timeouts.readthedocs.io](https://pytest-timeouts.readthedocs.io).
## About
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.
## Features
* `setup`, `execution` and `teardown` phase timeouts controllable by:
* opts: `--setup-timeout`, `--execution-timeout` and `--teardown-timeout`
* ini: `setup_timeout`, `execution_timeout` and `teardown_timeout`
* mark: `setup_timeout`, `execution_timeout` and `teardown_timeout`
* fixed order of timeout settings: **opts** > **markers** > **ini**, controlled by `--timeouts-order`
* `--timeouts-order` allow change order of override timeout settings, and disable some settings, i.e. `--timeout-order i` disable markers and opts, any combination is allow
* timeout disabled when debugging with PDB
## Installation
### Stable
```bash
pip install pytest-timeouts
```
### Master
```bash
pip install git+https://github.com/Scony/pytest-timeouts.git
```
## Usage
### Commandline
```bash
pytest --setup-timeout 2.5 --execution-timeout 2.01 --teardown-timeout 0
```
### `pytest.ini` setting
```ini
[pytest]
setup_timeout = 2.5
execution-timeout = 2.01
teardown-timeout = 0
```
### Mark
```python
import 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)
```
## Contributors
* Pawel Lampe
* Kamil Luczak
[](https://travis-ci.org/Scony/pytest-timeouts)
[](https://pytest-timeouts.readthedocs.io/en/latest/?badge=latest)




Linux-only Pytest plugin to control durations of various test case execution phases.
## Documentation
For documentation visit [pytest-timeouts.readthedocs.io](https://pytest-timeouts.readthedocs.io).
## About
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.
## Features
* `setup`, `execution` and `teardown` phase timeouts controllable by:
* opts: `--setup-timeout`, `--execution-timeout` and `--teardown-timeout`
* ini: `setup_timeout`, `execution_timeout` and `teardown_timeout`
* mark: `setup_timeout`, `execution_timeout` and `teardown_timeout`
* fixed order of timeout settings: **opts** > **markers** > **ini**, controlled by `--timeouts-order`
* `--timeouts-order` allow change order of override timeout settings, and disable some settings, i.e. `--timeout-order i` disable markers and opts, any combination is allow
* timeout disabled when debugging with PDB
## Installation
### Stable
```bash
pip install pytest-timeouts
```
### Master
```bash
pip install git+https://github.com/Scony/pytest-timeouts.git
```
## Usage
### Commandline
```bash
pytest --setup-timeout 2.5 --execution-timeout 2.01 --teardown-timeout 0
```
### `pytest.ini` setting
```ini
[pytest]
setup_timeout = 2.5
execution-timeout = 2.01
teardown-timeout = 0
```
### Mark
```python
import 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)
```
## Contributors
* Pawel Lampe
* Kamil Luczak
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest-timeouts-1.1.1.tar.gz
(3.9 kB
view details)
File details
Details for the file pytest-timeouts-1.1.1.tar.gz.
File metadata
- Download URL: pytest-timeouts-1.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a869627b9fed5c9108c6a0657c7f5dae2ac42e8e401478e52e1c11b323c54e8d
|
|
| MD5 |
176dc86d951dd89102b771f7ed33f089
|
|
| BLAKE2b-256 |
a7a83a79ffd4539be3b12a884c99974958733955c9d5c0e4817539ba88ce9930
|