Looks like you are using some plugin like pytest-html.
If that is the case check documentation for that plugin for what all hooks are provided.
for pytest-html following hooks are provided
You can add change the Environment section of the report by modifying request.config._html.environment
from a fixture:
@pytest.fixture(autouse=True)
def _environment(request):
request.config._environment.append(('foo', 'bar'))
You can add details to the HTML reports by creating an ‘extra’ list on the report object. The following example adds the various types of extras using a pytest_runtest_makereport
hook, which can be implemented in a plugin or conftest.py
file:
import pytest
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin('html')
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', [])
if report.when == 'call':
# always add url to report
extra.append(pytest_html.extras.url('http://www.example.com/'))
xfail = hasattr(report, 'wasxfail')
if (report.skipped and xfail) or (report.failed and not xfail):
# only add additional html on failure
extra.append(pytest_html.extras.html('<div>Additional HTML</div>'))
report.extra = extra