pytest-api-coverage
Pytest plugin for API test coverage analysis. Automatically intercepts HTTP requests during test execution, compares them against OpenAPI specifications, and generates detailed coverage reports.
Features
- Automatic HTTP interception — captures requests from
requestsandhttpxlibraries - Swagger/OpenAPI support — works with JSON and YAML specifications (local files or URLs)
- Multiple report formats — JSON, CSV, and HTML reports
- pytest-xdist support — works with parallel test execution
- Origin filtering — filter coverage by base URL or allowlist
- Split by origin — generate separate coverage per API origin
- Async support — intercepts both
requestsandhttpx, including async httpx clients - Multi-spec mode — measure coverage across multiple APIs in a single test run
Installation
Requires Python 3.11+ and pytest 7.0+.
# If your project uses requests
pip install pytest-api-coverage[requests]
# If your project uses httpx
pip install pytest-api-coverage[httpx]
# If your project uses both
pip install pytest-api-coverage[requests,httpx]
See Installation Guide for details.
Quick Start
# Basic usage with local spec file
pytest tests/ --coverage-spec=swagger.json
# Using remote spec URL
pytest tests/ --coverage-spec=https://api.example.com/swagger.json
# With parallel execution
pytest tests/ -n 4 --coverage-spec=swagger.json
Documentation
| Guide | Description |
|---|---|
| Installation | Requirements, install options, verification |
| Usage Guide | CLI options and examples |
| Configuration Reference | pytest.ini setup, multi-spec config |
| Coverage Reports | Report formats and result interpretation |
| API Reference | Public Python API for programmatic access |
| Architecture | How the plugin works internally |
| Troubleshooting | Common issues and fixes |
| Changelog | Release history |
| Contributing | Development setup and guidelines |
Contributing
Contributions are welcome. See CONTRIBUTING.md for development setup and guidelines.
License
MIT — see LICENSE for details.
Metadata
Release files for pytest-api-coverage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_api_coverage-0.1.0.tar.gz | 122.1 kB | With provenance | Details for pytest_api_coverage-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_api_coverage-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_api_coverage-0.1.0-py3-none-any.whl |
Total release size: 165.5 kB
Release files / pytest_api_coverage-0.1.0.tar.gz
| Download URL | pytest_api_coverage-0.1.0.tar.gz |
|---|---|
| Size | 122.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
402392879b8e4da14d782cf1f093506f3a71184d072de2492493477dc6ba53d2
|
|
BLAKE2b-256 checksum How to use checksums |
81d74391bc4c570107de2d506a37a51f8fd86f19446be9d978080f185e8b6e2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.
Transparency logRelease files / pytest_api_coverage-0.1.0-py3-none-any.whl
| Download URL | pytest_api_coverage-0.1.0-py3-none-any.whl |
|---|---|
| Size | 43.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eeda5d53f255c07e0a4b97851fb9e2fddf37ee5646f73a07295e5b2e8fd19956
|
|
BLAKE2b-256 checksum How to use checksums |
a280deb858d3708de378dd561ac0018cdb241c4b53f0dd0a45dcf0ec80060967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.
Transparency logSecurity for pytest-api-coverage 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pytest_api_coverage-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.