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.

Features

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

  • Fairly mobile friendly

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

  • reStructuredText support in test function documentation

  • 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;
    }
    body {
        font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
    }
{% endblock %}

Some additional filters are available for templates to use:

asset(path)

Takes a path to a local file 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="{{ 'temporary_path/image.png'|asset }}">
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.

cleandoc(s)

Clean docstring using inspect.cleandoc.

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.5.0.tar.gz (79.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_reporter_html1-0.5.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file pytest-reporter-html1-0.5.0.tar.gz.

File metadata

  • Download URL: pytest-reporter-html1-0.5.0.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pytest-reporter-html1-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c73038e9a3d8a5a90a3bd0b2c63639d125a3935143efb9202b44c6a46fba912d
MD5 f0d8323bed11a0fb5abd49bf6a71c251
BLAKE2b-256 c0523a6142ad2cc5fd8bd6728164193695d3346c864c13bc02b68fab75977c34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_reporter_html1-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for pytest_reporter_html1-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4262533a83a716960997579f3caa76c362be75061d49554261ea9d055c652e0d
MD5 50163ec700aa7d3041f720036d1b656f
BLAKE2b-256 cd4ccd8706e7ae595d7240a638d9dc6c5ba5aabf5d2dee8c276ef8a824f91125

See more details on using hashes here.

Supported by

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