Skip to main content

A basic HTML report template for Pytest

Project description

PyPI version

A basic HTML report for pytest using Jinja2 template engine. Based on pytest-reporter which provides the data to the template.

Features

  • Overview of files, tests, and phases with expandable sections

  • Includes information about tests such as documentation, markers, and fixtures

  • Fairly mobile friendly

  • Complies with Jenkins default CSP policy (with --split-report)

  • Support for pytest-metadata and pytest-rerunfailures

  • May be used as a base template for customization

Screenshot

Installation

You can install “pytest-reporter-html1” via pip from PyPI:

$ pip install pytest-reporter-html1

Usage

Specify the html1 template and the output path of the report:

$ pytest --template=html1/index.html --report=report.html

By default the report is self-contained, but you can separate CSS, images, and JavaScript by specifying the --split-report option.

Customization

You can inherit this template in your own to tailor parts of it to your own needs. It defines various blocks which you can override using template inheritance.

{% extends "html1/index.html" %}
{% block style %}
    {{ super() }}
    header {
        background-color: black;
    }
{% endblock %}

Some additional filters are available for templates to use:

asset(path_or_content, extension)

Takes a path to a local file or a raw bytes object and either returns a base64 encoded URL or a new relative URL to a copy depending on if the report is self-contained or not.

<img src="{{ 'path/to/image.png'|asset }}">
<img src="{{ raw_byte_data|asset('png') }}">
ansi(s)

Convert ANSI color codes to HTML.

strftime(value, format)

Format a Unix timestamp using datetime.strftime.

Started: {{ started|strftime('%Y-%m-%d %H:%M:%S') }}
timedelta(value)

Convert a time in seconds to a timedelta object.

rst(s)

Convert reStructuredText to HTML.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_reporter_html1-0.9.3.tar.gz (100.1 kB view details)

Uploaded Source

Built Distribution

pytest_reporter_html1-0.9.3-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_reporter_html1-0.9.3.tar.gz.

File metadata

  • Download URL: pytest_reporter_html1-0.9.3.tar.gz
  • Upload date:
  • Size: 100.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytest_reporter_html1-0.9.3.tar.gz
Algorithm Hash digest
SHA256 d3851da3a4f58952f9989e8d678177dc132c143b2d194642ffab5c323e92ad2f
MD5 71524d6b2511ab37423d5c09197184db
BLAKE2b-256 30aaaa15038867f23c6b5691d5bef798e06415d2c254cbdcf1d001941c25e424

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_reporter_html1-0.9.3.tar.gz:

Publisher: pythonpublish.yml on christiansandberg/pytest-reporter-html1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_reporter_html1-0.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_reporter_html1-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 14b14fdb6269e2a3a4f54207a386d9aed5ecd865422c90b6fb2e017cf823d2ca
MD5 b14ef495174db7c7a010c5e3ebc7e41b
BLAKE2b-256 c1a40e80f2369ac693be1e32f9b3a12a9d83624a5749d7676370ef8f351195b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_reporter_html1-0.9.3-py3-none-any.whl:

Publisher: pythonpublish.yml on christiansandberg/pytest-reporter-html1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page