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

  • Expand and retract sections as needed

  • Tests organized by files

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

  • reStructuredText support in test function documentation

  • Minified content

  • 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.3.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

pytest_reporter_html1-0.3.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-reporter-html1-0.3.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pytest-reporter-html1-0.3.0.tar.gz
Algorithm Hash digest
SHA256 acafdb06644afc27b8aae210e9c5d9446ff2dbeb75fa2fdb5818d0c4e453ad9f
MD5 a4b906f5ae79514ebf751996c7c4dbc5
BLAKE2b-256 4f6ae06fd613e6b69d3e3f17101cdab144022d4fef500d66baae02d026a1c96c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_reporter_html1-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 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/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pytest_reporter_html1-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b58f5c9b8c231eb27d8ee987fcc1d62a968cdb57e8fa78c351e800ccd28d443
MD5 c613edc4eb0a1a7f361ab6375b0a8339
BLAKE2b-256 a1496da7b1cf447abc23ac70251e05632d59ff696bbbf2550f2af263f2f5bc0b

See more details on using hashes here.

Supported by

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