Pytest HTML1 Reporter

0.9.5 · active · verified Thu Apr 16

Pytest-reporter-html1 is a basic HTML report template for Pytest, leveraging the Jinja2 template engine. It extends `pytest-reporter` to generate rich, expandable reports covering test files, phases, and detailed test information. The current version is 0.9.5, and it maintains an active release cadence for bug fixes and feature enhancements.

Common errors

Warnings

Install

Quickstart

To generate an HTML report, run pytest with the `--template` and `--report` command-line options. The `--template` argument specifies the template to use (here, `html1/index.html`), and `--report` defines the output path and filename for the generated HTML report. By default, the report is self-contained. Use `--split-report` to separate assets like CSS and JavaScript.

# tests/test_example.py
def test_success():
    assert True

def test_failure():
    assert False

# Run from your terminal in the project root
# This command will generate a detailed HTML report named 'report.html'
# using the html1 template.
# pytest --template=html1/index.html --report=report.html

# To make the report self-contained (embed CSS, JS, images):
# pytest --template=html1/index.html --report=report.html --split-report=False
# Note: --split-report=False is the default behavior. For older versions, --self-contained might be used, but is deprecated.

# To split assets (CSS, JS, images) into separate files:
# pytest --template=html1/index.html --report=report.html --split-report

view raw JSON →