Skip to content

Commit

Permalink
Merge pull request #28 from christiansandberg/bugfix/27-doctest-support
Browse files Browse the repository at this point in the history
Fix doctests
  • Loading branch information
christiansandberg authored Aug 8, 2024
2 parents 7bee9de + 979aabc commit 4a8401a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pytest_reporter_html1/templates/html1/test.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% block test_content scoped %}
{% if test.item.function.__doc__ %}
{% if test.item.function and test.item.function.__doc__ %}
<div class="documentation">
{{ test.item.function.__doc__|cleandoc|rst|safe }}
</div>
Expand Down
4 changes: 4 additions & 0 deletions tests/samples/sample_doctest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
hello this is a doctest
>>> x = 3
>>> x
4
1 change: 1 addition & 0 deletions tests/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_sample_report(args, testdir, pytestconfig):
report = "{}/report/{}".format(pytestconfig.rootdir, args[0])
result = testdir.runpytest(
*args[1:],
"--doctest-glob", "sample_*.txt",
"--template=html1/index.html",
"--report=" + report
)
Expand Down

0 comments on commit 4a8401a

Please sign in to comment.