pytest-timeouts-1.2.1
توضیحات
Linux-only Pytest plugin to control durations of various test case execution phases
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Unix |
| نام فایل | pytest-timeouts-1.2.1 |
| نام | pytest-timeouts |
| نسخه کتابخانه | 1.2.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pawel Lampe |
| ایمیل نویسنده | pawel.lampe@gmail.com |
| آدرس صفحه اصلی | https://github.com/Scony/pytest-timeouts |
| آدرس اینترنتی | https://pypi.org/project/pytest-timeouts/ |
| مجوز | MIT license |
# pytest-timeouts
[](https://travis-ci.org/Scony/pytest-timeouts)
[](https://codecov.io/gh/Scony/pytest-timeouts)
[](https://pytest-timeouts.readthedocs.io/en/latest/?badge=latest)
[](https://pypi.org/project/pytest-timeouts/)


[](https://pepy.tech/project/pytest-timeouts)
[](https://github.com/Scony/pytest-timeouts/blob/master/LICENSE)

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
### Command line
```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
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* | Python |
نحوه نصب
نصب پکیج whl pytest-timeouts-1.2.1:
pip install pytest-timeouts-1.2.1.whl
نصب پکیج tar.gz pytest-timeouts-1.2.1:
pip install pytest-timeouts-1.2.1.tar.gz