@@ -229,6 +229,27 @@ def test_stdout():
229229 assert content not in html
230230 assert escaped in html
231231
232+ def test_custom_content_in_summary (self , testdir ):
233+ content_prefix = str (random .random ())
234+ content_summary = str (random .random ())
235+ content_suffix = str (random .random ())
236+ testdir .makeconftest ("""
237+ import pytest
238+ from py.xml import html
239+
240+ @pytest.mark.optionalhook
241+ def pytest_html_results_summary(prefix, summary, postfix):
242+ prefix.append(html.p("prefix is {0}"))
243+ summary.extend([html.p("extra summary is {1}")])
244+ postfix.extend([html.p("postfix is {2}")])
245+ """ .format (content_prefix , content_summary , content_suffix ))
246+ testdir .makepyfile ('def test_pass(): pass' )
247+ result , html = run (testdir )
248+ assert result .ret == 0
249+ assert len (re .findall (content_prefix , html )) == 1
250+ assert len (re .findall (content_summary , html )) == 1
251+ assert len (re .findall (content_suffix , html )) == 1
252+
232253 def test_extra_html (self , testdir ):
233254 content = str (random .random ())
234255 testdir .makeconftest ("""
0 commit comments