A basic HTML report template for Pytest
Project description
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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-reporter-html1-0.8.2.tar.gz
.
File metadata
- Download URL: pytest-reporter-html1-0.8.2.tar.gz
- Upload date:
- Size: 99.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b36cc94e0029fb093983095fd887000d0a21f1ebfa21745335fc91ee028366c |
|
MD5 | b8c42c0b95279be91502b528f6afcdce |
|
BLAKE2b-256 | 144e261910ca4492ad34be6c963a0c8db710267fda9ee8d80e6ee890cb54eef8 |
File details
Details for the file pytest_reporter_html1-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: pytest_reporter_html1-0.8.2-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e99824d148e4a91e57861b0c7965935f77f9a56a1ba92f79e1320ba8c489420d |
|
MD5 | d4be8541d1a6ea7b132c4f75c3226ee1 |
|
BLAKE2b-256 | 5f5dfccd5b587167e3d013370305453eb61f1182aff51c42b144c7b247410d22 |