Skip to main content

pytest-timeouts

Build Status codecov Documentation Status PyPI pyversion Supported pytest 3|4 Downloads PyPI - License GitHub Release Date

Linux-only Pytest plugin to control durations of various test case execution phases.

Documentation

For documentation visit 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

pip install pytest-timeouts

Master

pip install git+https://github.com/Scony/pytest-timeouts.git

Usage

Command line

pytest --setup-timeout 2.5 --execution-timeout 2.01  --teardown-timeout 0

pytest.ini setting

[pytest]
setup_timeout = 2.5
execution_timeout = 2.01
teardown_timeout = 0

Mark

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

Metadata

Release files for pytest-timeouts 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-timeouts 1.2.1
File Size Uploaded
pytest-timeouts-1.2.1.tar.gz 5.0 kB Details

Release files / pytest-timeouts-1.2.1.tar.gz

Download URL pytest-timeouts-1.2.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
390351afc7ecb422ea0ec38081e0acd91cad416b383944a9a3358087de50c2fb
BLAKE2b-256 checksum
How to use checksums
cf479a8d7fa18736d69d218e303345dfe21755e956fd863b0f043ef854ff84a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.2.1 This release

1 release file

1.2

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page