Skip to content

Getting Started

Installation

# Basic
pip install pytest-llm-report

# With uv
uv add pytest-llm-report

For LLM support:

# Ollama (local)
pip install pytest-llm-report[ollama]

# LiteLLM (cloud)
pip install pytest-llm-report[litellm]

# Gemini (cloud)
pip install pytest-llm-report[gemini]

Prerequisites

You need pytest-cov with context tracking:

pip install pytest-cov

Basic Usage

1. Configure coverage

Add to your pyproject.toml:

[tool.pytest.ini_options]
addopts = [
    "--cov=your_package",
    "--cov-context=test",
    "--cov-report=",
]

2. Generate a report

pytest --llm-report=report.html

Optional: PDF output

PDF output uses Playwright to render the HTML report.

pip install playwright
playwright install chromium
pytest --llm-report=report.html --llm-pdf=report.pdf

3. View the report

Open report.html in a browser to see: - Test summary (passed/failed/skipped) - Per-test coverage (files and lines) - Filter and search functionality - Dark mode (automatic based on system preferences)

Next Steps