Skip to content

Commit

Permalink
Add support for user properties
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansandberg committed Jun 9, 2020
1 parent 7f51b79 commit a2cf3a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pytest_reporter_html1/templates/html1/module.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ <h3 class="test-name">{% block test_name scoped %}{{ test.item.name }}{% endbloc
<th>Duration</th>
<td>{{ test.phases|sum(attribute='report.duration')|timedelta }}</td>
</tr>
{% for name, value in test.item.user_properties %}
<tr>
<th>{{ name|title }}</th>
<td>{{ value|escape|urlize }}</td>
</tr>
{% endfor %}
{% set markers = test.item.iter_markers()|rejectattr('name', '==', 'parametrize')|list %}
{% if markers %}
<tr>
Expand Down
7 changes: 7 additions & 0 deletions tests/samples/sample_test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def test_with_documentation():
.. _`pytest`: https://github.com/pytest-dev/pytest
"""
pass


def test_user_properties(record_property):
record_property("string", "Some string value")
record_property("integer", 123)
record_property("xml", "<blink>Blink!</blink>")
record_property("url", "https://github.com/christiansandberg/pytest-reporter-html1")

0 comments on commit a2cf3a8

Please sign in to comment.