92
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill jmagly/aiwg --skill pytest-runner- SKILL.md4.3 KB
Overview
This skill runs and manages Python test suites using pytest with support for fixtures, markers, coverage, and parallel execution. It focuses on safe, repeatable test execution: environment checks, discovery, execution, result parsing, and failure recovery. Checkpoints capture collections, results, coverage, and diagnostics for reproducibility.
How this skill works
Before running tests the skill verifies a Python virtual environment and that pytest (and optional plugins like pytest-xdist and pytest-cov) are installed. It discovers tests, runs them with user-specified options (markers, coverage, parallel workers), captures output and coverage, and stores structured checkpoints. On failures it performs automated diagnostics and suggests narrow reruns or escalation.
When to use it
- Automating local or CI test runs for Python projects
- Collecting coverage reports and HTML summaries
- Running large suites in parallel with pytest-xdist
- Filtering tests by marker, keyword, or last-failed behavior
- Diagnosing test collection, fixture, or import errors
Best practices
- Always verify or activate a virtual environment before running tests
- Install and confirm required pytest plugins (pytest-cov, pytest-xdist) before parallel or coverage runs
- Prefer targeted runs (markers, -k, --lf) during debugging to reduce noise
- Save test collections and results to checkpoints for reproducibility and postmortem analysis
- Ask the user when multiple test dirs, unclear coverage thresholds, or parallelization choices arise
Example use cases
- Run full test suite with coverage and HTML report: python -m pytest tests/ -v --cov=src --cov-report=html
- Run unit tests only using marker filtering: python -m pytest tests/ -v -m "unit"
- Execute tests in parallel: python -m pytest tests/ -v -n auto (requires pytest-xdist)
- Collect failing tests and retry narrower scope up to 3 attempts, then escalate with diagnostics
- Generate a short traceback run and save output to test_results.txt for failure parsing
FAQ
It ensures a Python virtual environment is active or available, verifies pytest is installed, and checks that test files and optional pytest config exist.
How does it handle flaky or failing tests?
It captures outputs, diagnoses common error types (ImportError, FixtureError, CollectionError, Timeout), narrows scope for retries (max 3), and escalates with contextual failure reports if unresolved.