Skip to content

Commit 559cc17

Browse files
Use config object to store extras
1 parent a8292bb commit 559cc17

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytest_html/plugin.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,13 @@ def pytest_runtest_makereport(item, call):
9898
outcome = yield
9999
report = outcome.get_result()
100100
if report.when == "call":
101+
fixture_extras = getattr(item.config, "extras", [])
101102
plugin_extras = getattr(report, "extra", [])
102103
report.extra = fixture_extras + plugin_extras
103104

104105

105106
@pytest.fixture
106-
def extra():
107+
def extra(pytestconfig):
107108
"""Add details to the HTML reports.
108109
109110
.. code-block:: python
@@ -112,8 +113,9 @@ def extra():
112113
def test_foo(extra):
113114
extra.append(pytest_html.extras.url('http://www.example.com/'))
114115
"""
115-
del fixture_extras[:]
116-
return fixture_extras
116+
pytestconfig.extras = []
117+
yield pytestconfig.extras
118+
del pytestconfig.extras[:]
117119

118120

119121
def data_uri(content, mime_type="text/plain", charset="utf-8"):

0 commit comments

Comments
 (0)