Skip to main content

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

Project description

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

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.2.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file pytest-timeouts-1.2.tar.gz.

File metadata

  • Download URL: pytest-timeouts-1.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for pytest-timeouts-1.2.tar.gz
Algorithm Hash digest
SHA256 9f12cb6f7c051b67ce6517420d514c4fcbac05acb7fd4c40967a3f0b49f902cc
MD5 e41a3394737713be3e0eece3790ddefe
BLAKE2b-256 038ad78004b13f32ce8ed0e6396e122599ed34fcebdb136fbfd31f67afd2b66c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page