Skip to content
Snippets Groups Projects
Verified Commit e7360410 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

conftest: make pytest-html optional

We do not need pytest-html for normal functionality. It is just nice
plugin we can use to generate human readable report to go alongside with
pytest native xml and log output.
We also support only pytest-html with minimal version 2.1.0 and thus all
this is included only if pytest-html is at least of that version.

The plugin is removed by this from requirements.txt as this file lists
necessary Python packages and this is now only optional.
parent 34197d04
Branches
1 merge request!19conftest: make pytest-html optional
import pkg_resources
def pytest_html_report_title(report):
report.title = "NSFarm tests report"
def pytest_configure(config):
html_plugin = config.pluginmanager.getplugin("html")
if html_plugin is not None and \
pkg_resources.parse_version(html_plugin.__version__) >= pkg_resources.parse_version("2.1.0"):
config.pluginmanager.register(HTMLReport())
class HTMLReport:
"""Hooks for optional Pytest HTML plugin.
(Pytest fails in case there is hooks with unknown handler. This way we include it only if we have pytest-html.)
"""
def pytest_html_report_title(self, report):
report.title = "NSFarm tests report"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment