diff --git a/pytest_reporter_html1/plugin.py b/pytest_reporter_html1/plugin.py index de19385..edc361a 100644 --- a/pytest_reporter_html1/plugin.py +++ b/pytest_reporter_html1/plugin.py @@ -95,6 +95,12 @@ def pytest_reporter_loader(self, dirs, config): def pytest_reporter_context(self, context, config): context.setdefault("colors", COLORS) context.setdefault("time_format", "%Y-%m-%d %H:%M:%S") + metadata = context.setdefault("metadata", {}) + + if config.pluginmanager.getplugin("metadata"): + from pytest_metadata.plugin import metadata_key + + metadata.update(config.stash[metadata_key]) def _cssfilter(self, css): if self.self_contained: diff --git a/pytest_reporter_html1/templates/html1/index.html b/pytest_reporter_html1/templates/html1/index.html index 17bd523..eec16a3 100644 --- a/pytest_reporter_html1/templates/html1/index.html +++ b/pytest_reporter_html1/templates/html1/index.html @@ -32,22 +32,20 @@

Summary

Total run time {{ tests|map(attribute='phases')|map('sum', 'report.duration')|sum|timedelta }} - {% if config._metadata %} - {% for key, value in config._metadata.items() %} - - {{ key }} - - {% if value is mapping %} - {% for key, value in value.items() %} - {{ key }}: {{ value }}
- {% endfor %} - {% else %} - {{ value|urlize }} - {% endif %} - - - {% endfor %} - {% endif %} + {% for key, value in metadata.items() %} + + {{ key }} + + {% if value is mapping %} + {% for key, value in value.items() %} + {{ key }}: {{ value }}
+ {% endfor %} + {% else %} + {{ value|urlize }} + {% endif %} + + + {% endfor %} {% endblock %}