A pytest plugin for enhanced test reliability and monitoring
Project description
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-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.0PYTEST_VIGIL__CI_MULTIPLIER=2.0PYTEST_VIGIL__STALL_TIMEOUT=10.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_vigil-0.1.0.tar.gz.
File metadata
- Download URL: pytest_vigil-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1a9f1b18e3f1f5f25d9a7f71df1a764ce968f065ecd359212307813d9108b5a
|
|
| MD5 |
11843bdc8bf280fea545be4dca5a7039
|
|
| BLAKE2b-256 |
73dd7cb70e70f6af03fd68a01b200e84d99ffeeadc171213c53eeb63b9e17e38
|
Provenance
The following attestation bundles were made for pytest_vigil-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on l0kifs/pytest-vigil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_vigil-0.1.0.tar.gz -
Subject digest:
b1a9f1b18e3f1f5f25d9a7f71df1a764ce968f065ecd359212307813d9108b5a - Sigstore transparency entry: 920109436
- Sigstore integration time:
-
Permalink:
l0kifs/pytest-vigil@07fa44efc11214e71b1865d9a3cb2cefe3694617 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/l0kifs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@07fa44efc11214e71b1865d9a3cb2cefe3694617 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pytest_vigil-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_vigil-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cf3d2202e7975034d26afc91993d67ca9c6b8f4a12cc40d88ebe34a20832bda
|
|
| MD5 |
5c7bd6d784e3c7c9b1e24e84e508d6ff
|
|
| BLAKE2b-256 |
7759b4abb7a93044cc3a66927663112212226eb982398b37397083f04a8e3dca
|
Provenance
The following attestation bundles were made for pytest_vigil-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on l0kifs/pytest-vigil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_vigil-0.1.0-py3-none-any.whl -
Subject digest:
2cf3d2202e7975034d26afc91993d67ca9c6b8f4a12cc40d88ebe34a20832bda - Sigstore transparency entry: 920109437
- Sigstore integration time:
-
Permalink:
l0kifs/pytest-vigil@07fa44efc11214e71b1865d9a3cb2cefe3694617 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/l0kifs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@07fa44efc11214e71b1865d9a3cb2cefe3694617 -
Trigger Event:
workflow_dispatch
-
Statement type: