pytest-cov

7.1.0 · active · verified Sat Mar 28

Pytest plugin for measuring coverage. Current version: 7.1.0. Released on March 2, 2026. Maintained with regular updates.

Warnings

Install

Quickstart

Set the environment variable 'PROJECT_DIR' to your project's path and run pytest with coverage measurement.

import os
import pytest

# Set the environment variable for the project directory
os.environ['PROJECT_DIR'] = '/path/to/your/project'

# Run pytest with coverage measurement
pytest.main(['--cov', os.environ['PROJECT_DIR'], 'tests/'])

view raw JSON →