Skip to main content

A pytest plugin for enhanced test reliability and monitoring

Project description

pytest-vigil

Pytest Vigil - Reliability Vigilance for Pytest

License: MIT Python GitHub last commit GitHub Release Date GitHub repo size PyPI - Downloads PyPI version

Features

  • Resource Enforcement: Set hard limits on Time, Memory (MB), and CPU (%).
  • Stall Detection: Detects deadlocks by monitoring low CPU usage over time.
  • CI Awareness: Automatically scales limits (default 2x) when running in CI environments.
  • Flake Management: Built-in retry mechanism for failed or resource-violating tests.
  • Detailed Reporting: Generates JSON reports with resource usage metrics.
  • Debug context: Dumps thread stacks upon timeout/interrupt.

Installation

uv add -D pytest-vigil
# or
pip install pytest-vigil

Usage

CLI Options

Option Unit Required Default Description
--vigil-timeout s No None Test timeout
--vigil-memory MB No None Memory limit
--vigil-cpu % No None CPU limit
--vigil-retry - No 0 Number of retries on failure
--vigil-stall-timeout s No None Max duration of low CPU activity
--vigil-stall-cpu-threshold % No 0.1 CPU threshold for stall detection
--vigil-report - No None Path to JSON report file
pytest --vigil-timeout 5 --vigil-memory 512 --vigil-cpu 80

Markers

Apply limits to specific tests. All arguments are optional.

Parameter Type Unit Default Description
timeout float s None Test timeout
memory float MB None Memory limit
cpu float % None CPU limit
retry int - 0 Number of retries on failure
stall_timeout float s None Max duration of low CPU activity
stall_cpu_threshold float % 0.1 CPU threshold for stall detection
import pytest

@pytest.mark.vigil(timeout=5.0, memory=512, retry=2)
def test_critical_path():
    ...

Configuration (Env)

Configure via environment variables (prefix PYTEST_VIGIL__):

  • PYTEST_VIGIL__TIMEOUT=5.0
  • PYTEST_VIGIL__CI_MULTIPLIER=2.0
  • PYTEST_VIGIL__STALL_TIMEOUT=10.0

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_vigil-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_vigil-0.2.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_vigil-0.2.0.tar.gz.

File metadata

  • Download URL: pytest_vigil-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_vigil-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f0382815471e45cfe1a10966e35c6b674df7d34700ac8c64d4ff52c7eb13d289
MD5 7b5b42ff9e34366e0db299510299048d
BLAKE2b-256 be43c0ecd6626fc4c6fe51026f20a8438d8b5e22411beccf69902b76b22bd57b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_vigil-0.2.0.tar.gz:

Publisher: publish-to-pypi.yml on l0kifs/pytest-vigil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_vigil-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_vigil-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_vigil-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 106e6941a76d7072d91a74bb0b9e890d904b90408fd59325abacb2d4e7216cc8
MD5 4522c485eaeeec88e84d73987b73c13f
BLAKE2b-256 8c5babf730b255e030694246af3cbbb42e18bf22004f3369288e38d815690614

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_vigil-0.2.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on l0kifs/pytest-vigil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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