pytest-reporter-html1


Namepytest-reporter-html1 JSON
Version 0.9.2 PyPI version JSON
download
home_pagehttps://github.com/christiansandberg/pytest-reporter-html1
SummaryA basic HTML report template for Pytest
upload_time2024-10-11 07:24:16
maintainerChristian Sandberg
docs_urlNone
authorChristian Sandberg
requires_python>=3.5
licenseMIT
keywords
VCS
bugtrack_url
requirements pytest pytest-rerunfailures pytest-metadata pytest-xdist beautifulsoup4
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====================
pytest-reporter-html1
=====================

.. 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.


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

.. image:: https://raw.githubusercontent.com/christiansandberg/pytest-reporter-html1/master/screenshot.png
    :alt: 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`_.

.. 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.


Issues
------

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/christiansandberg/pytest-reporter-html1",
    "name": "pytest-reporter-html1",
    "maintainer": "Christian Sandberg",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "christiansandberg@me.com",
    "keywords": null,
    "author": "Christian Sandberg",
    "author_email": "christiansandberg@me.com",
    "download_url": "https://files.pythonhosted.org/packages/44/c9/eda36ab2d7bd20acc9c8ce7a02ae188e3ac9f48971de84106d9f8df30ca6/pytest_reporter_html1-0.9.2.tar.gz",
    "platform": null,
    "description": "=====================\npytest-reporter-html1\n=====================\n\n.. image:: https://img.shields.io/pypi/v/pytest-reporter-html1.svg\n    :target: https://pypi.org/project/pytest-reporter-html1\n    :alt: PyPI version\n\nA basic HTML report for `pytest`_ using `Jinja2`_ template engine.\nBased on `pytest-reporter`_ which provides the data to the template.\n\n\nFeatures\n--------\n\n* Overview of files, tests, and phases with expandable sections\n* Includes information about tests such as documentation, markers, and fixtures\n* Fairly mobile friendly\n* Complies with Jenkins default CSP policy (with ``--split-report``)\n* Support for `pytest-metadata`_ and `pytest-rerunfailures`_\n* May be used as a base template for customization\n\n.. image:: https://raw.githubusercontent.com/christiansandberg/pytest-reporter-html1/master/screenshot.png\n    :alt: Screenshot\n\n\nInstallation\n------------\n\nYou can install \"pytest-reporter-html1\" via `pip`_ from `PyPI`_::\n\n    $ pip install pytest-reporter-html1\n\n\nUsage\n-----\n\nSpecify the html1 template and the output path of the report::\n\n    $ pytest --template=html1/index.html --report=report.html\n\nBy default the report is self-contained, but you can separate CSS, images,\nand JavaScript by specifying the ``--split-report`` option.\n\n\nCustomization\n-------------\n\nYou can inherit this template in your own to tailor parts of it to your own needs.\nIt defines various blocks which you can override using `template inheritance`_.\n\n.. code:: html\n\n    {% extends \"html1/index.html\" %}\n    {% block style %}\n        {{ super() }}\n        header {\n            background-color: black;\n        }\n    {% endblock %}\n\nSome additional filters are available for templates to use:\n\n``asset(path_or_content, extension)``\n    Takes a path to a local file or a raw bytes object and either returns a\n    base64 encoded URL or a new relative URL to a copy depending on if the\n    report is self-contained or not.\n\n    .. code:: html\n\n        <img src=\"{{ 'path/to/image.png'|asset }}\">\n        <img src=\"{{ raw_byte_data|asset('png') }}\">\n\n``ansi(s)``\n    Convert ANSI color codes to HTML.\n\n``strftime(value, format)``\n    Format a Unix timestamp using `datetime.strftime`_.\n\n    .. code:: html\n\n        Started: {{ started|strftime('%Y-%m-%d %H:%M:%S') }}\n\n``timedelta(value)``\n    Convert a time in seconds to a `timedelta`_ object.\n\n``rst(s)``\n    Convert reStructuredText to HTML.\n\n\nIssues\n------\n\nIf you encounter any problems, please `file an issue`_ along with a detailed description.\n\n.. _`Jinja2`: https://jinja.palletsprojects.com/\n.. _`template inheritance`: https://jinja.palletsprojects.com/en/master/templates/#template-inheritance\n.. _`file an issue`: https://github.com/christiansandberg/pytest-reporter-html1/issues\n.. _`pytest`: https://github.com/pytest-dev/pytest\n.. _`pytest-reporter`: https://github.com/christiansandberg/pytest-reporter\n.. _`pytest-metadata`: https://github.com/pytest-dev/pytest-metadata\n.. _`pytest-rerunfailures`: https://github.com/pytest-dev/pytest-rerunfailures\n.. _`pip`: https://pypi.org/project/pip/\n.. _`PyPI`: https://pypi.org/project\n.. _`datetime.strftime`: https://docs.python.org/3/library/datetime.html#datetime.datetime.strftime\n.. _`timedelta`: https://docs.python.org/3/library/datetime.html#timedelta-objects\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A basic HTML report template for Pytest",
    "version": "0.9.2",
    "project_urls": {
        "Homepage": "https://github.com/christiansandberg/pytest-reporter-html1"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb26d9d1661b425a8d7c84f693aeb53a8de5416798b452e62de271e123bfad6b",
                "md5": "21b63904804912ce9ea5de4be0a8635f",
                "sha256": "e355e1af547b5345368d1dd025395751e5a8e9be0df5be7ae9403b692bf14053"
            },
            "downloads": -1,
            "filename": "pytest_reporter_html1-0.9.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21b63904804912ce9ea5de4be0a8635f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 16514,
            "upload_time": "2024-10-11T07:24:15",
            "upload_time_iso_8601": "2024-10-11T07:24:15.365818Z",
            "url": "https://files.pythonhosted.org/packages/eb/26/d9d1661b425a8d7c84f693aeb53a8de5416798b452e62de271e123bfad6b/pytest_reporter_html1-0.9.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44c9eda36ab2d7bd20acc9c8ce7a02ae188e3ac9f48971de84106d9f8df30ca6",
                "md5": "0f93c54a57e4d4ed2c75e82ab10783ff",
                "sha256": "7aca7adb85ec2dd5bcf6b26cc46bda9887b970773f3af65752ee40b0b6d6cb14"
            },
            "downloads": -1,
            "filename": "pytest_reporter_html1-0.9.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0f93c54a57e4d4ed2c75e82ab10783ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 100184,
            "upload_time": "2024-10-11T07:24:16",
            "upload_time_iso_8601": "2024-10-11T07:24:16.694048Z",
            "url": "https://files.pythonhosted.org/packages/44/c9/eda36ab2d7bd20acc9c8ce7a02ae188e3ac9f48971de84106d9f8df30ca6/pytest_reporter_html1-0.9.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 07:24:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "christiansandberg",
    "github_project": "pytest-reporter-html1",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "pytest-rerunfailures",
            "specs": []
        },
        {
            "name": "pytest-metadata",
            "specs": []
        },
        {
            "name": "pytest-xdist",
            "specs": []
        },
        {
            "name": "beautifulsoup4",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "pytest-reporter-html1"
}
        
Elapsed time: 4.49191s