Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
pytest-reporter-html1
Advanced tools
.. image:: https://img.shields.io/pypi/v/pytest-reporter-html1.svg :target: https://pypi.org/project/pytest-reporter-html1 :alt: PyPI version
A basic HTML report for pytest
_ using Jinja2
_ template engine.
Based on pytest-reporter
_ which provides the data to the template.
--split-report
)pytest-metadata
_ and pytest-rerunfailures
_.. image:: https://raw.githubusercontent.com/christiansandberg/pytest-reporter-html1/master/screenshot.png :alt: Screenshot
You can install "pytest-reporter-html1" via pip
_ from PyPI
_::
$ pip install pytest-reporter-html1
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.
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
_.
.. code:: html
{% 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.
.. code:: html
<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
_.
.. code:: html
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.
If you encounter any problems, please file an issue
_ along with a detailed description.
.. _Jinja2
: https://jinja.palletsprojects.com/
.. _template inheritance
: https://jinja.palletsprojects.com/en/master/templates/#template-inheritance
.. _file an issue
: https://github.com/christiansandberg/pytest-reporter-html1/issues
.. _pytest
: https://github.com/pytest-dev/pytest
.. _pytest-reporter
: https://github.com/christiansandberg/pytest-reporter
.. _pytest-metadata
: https://github.com/pytest-dev/pytest-metadata
.. _pytest-rerunfailures
: https://github.com/pytest-dev/pytest-rerunfailures
.. _pip
: https://pypi.org/project/pip/
.. _PyPI
: https://pypi.org/project
.. _datetime.strftime
: https://docs.python.org/3/library/datetime.html#datetime.datetime.strftime
.. _timedelta
: https://docs.python.org/3/library/datetime.html#timedelta-objects
FAQs
A basic HTML report template for Pytest
We found that pytest-reporter-html1 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.