Metadata-Version: 2.4
Name: pytest-api-coverage
Version: 0.1.0
Summary: Pytest plugin for API test coverage analysis
Project-URL: Homepage, https://github.com/anatolybobunov/pytest-api-coverage
Project-URL: Repository, https://github.com/anatolybobunov/pytest-api-coverage
Project-URL: Documentation, https://github.com/anatolybobunov/pytest-api-coverage#readme
Project-URL: Changelog, https://github.com/anatolybobunov/pytest-api-coverage/blob/main/CHANGELOG.md
Project-URL: Bug Tracker, https://github.com/anatolybobunov/pytest-api-coverage/issues
Author-email: Anatoly Bobunov <dev.bobunov@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: api,coverage,openapi,pytest,pytest-xdist,swagger,test,testing
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: jinja2>=3.0.0
Requires-Dist: pytest>=7.0.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: all
Requires-Dist: httpx>=0.24.0; extra == 'all'
Requires-Dist: requests>=2.28.0; extra == 'all'
Provides-Extra: httpx
Requires-Dist: httpx>=0.24.0; extra == 'httpx'
Provides-Extra: requests
Requires-Dist: requests>=2.28.0; extra == 'requests'
Description-Content-Type: text/markdown

# pytest-api-coverage

[![PyPI version](https://img.shields.io/pypi/v/pytest-api-coverage.svg)](https://pypi.org/project/pytest-api-coverage/)
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-api-coverage.svg)](https://pypi.org/project/pytest-api-coverage/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/anatolybobunov/pytest-api-coverage/actions/workflows/ci.yml/badge.svg)](https://github.com/anatolybobunov/pytest-api-coverage/actions/workflows/ci.yml)

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 `requests` and `httpx` libraries
- **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 `requests` and `httpx`, 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+**.

```bash
# 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](docs/installation.md) for details.

## Quick Start

```bash
# 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](docs/installation.md) | Requirements, install options, verification |
| [Usage Guide](docs/usage.md) | CLI options and examples |
| [Configuration Reference](docs/configuration.md) | pytest.ini setup, multi-spec config |
| [Coverage Reports](docs/reports.md) | Report formats and result interpretation |
| [API Reference](docs/api-reference.md) | Public Python API for programmatic access |
| [Architecture](docs/architecture.md) | How the plugin works internally |
| [Troubleshooting](docs/troubleshooting.md) | Common issues and fixes |
| [Changelog](CHANGELOG.md) | Release history |
| [Contributing](CONTRIBUTING.md) | Development setup and guidelines |

## Contributing

Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.

## License

MIT — see [LICENSE](LICENSE) for details.
