pytest_beehave.html_steps_plugin
HTML Acceptance Criteria column plugin for pytest-beehave.
1"""HTML Acceptance Criteria column plugin for pytest-beehave.""" 2 3from __future__ import annotations 4 5import pytest 6 7 8class HtmlStepsPlugin: 9 """Adds an Acceptance Criteria column to pytest-html reports.""" 10 11 def pytest_html_results_table_header(self, cells: list[object]) -> None: 12 """Insert the Acceptance Criteria column header. 13 14 Args: 15 cells: The list of header cells to modify. 16 """ 17 cells.insert(2, "<th>Acceptance Criteria</th>") 18 19 def pytest_html_results_table_row( 20 self, report: pytest.TestReport, cells: list[object] 21 ) -> None: 22 """Insert the Acceptance Criteria column value for each row. 23 24 Args: 25 report: The test report for this row. 26 cells: The list of row cells to modify. 27 """ 28 nodeid = report.nodeid 29 if "tests/features/" in nodeid: 30 docstring = getattr(report, "_beehave_docstring", "") or "" 31 else: 32 docstring = "" 33 cells.insert(2, f"<td style='white-space: pre-wrap;'>{docstring}</td>")
class
HtmlStepsPlugin:
9class HtmlStepsPlugin: 10 """Adds an Acceptance Criteria column to pytest-html reports.""" 11 12 def pytest_html_results_table_header(self, cells: list[object]) -> None: 13 """Insert the Acceptance Criteria column header. 14 15 Args: 16 cells: The list of header cells to modify. 17 """ 18 cells.insert(2, "<th>Acceptance Criteria</th>") 19 20 def pytest_html_results_table_row( 21 self, report: pytest.TestReport, cells: list[object] 22 ) -> None: 23 """Insert the Acceptance Criteria column value for each row. 24 25 Args: 26 report: The test report for this row. 27 cells: The list of row cells to modify. 28 """ 29 nodeid = report.nodeid 30 if "tests/features/" in nodeid: 31 docstring = getattr(report, "_beehave_docstring", "") or "" 32 else: 33 docstring = "" 34 cells.insert(2, f"<td style='white-space: pre-wrap;'>{docstring}</td>")
Adds an Acceptance Criteria column to pytest-html reports.
def
pytest_html_results_table_header(self, cells: list[object]) -> None:
12 def pytest_html_results_table_header(self, cells: list[object]) -> None: 13 """Insert the Acceptance Criteria column header. 14 15 Args: 16 cells: The list of header cells to modify. 17 """ 18 cells.insert(2, "<th>Acceptance Criteria</th>")
Insert the Acceptance Criteria column header.
Args: cells: The list of header cells to modify.
def
pytest_html_results_table_row(self, report: _pytest.reports.TestReport, cells: list[object]) -> None:
20 def pytest_html_results_table_row( 21 self, report: pytest.TestReport, cells: list[object] 22 ) -> None: 23 """Insert the Acceptance Criteria column value for each row. 24 25 Args: 26 report: The test report for this row. 27 cells: The list of row cells to modify. 28 """ 29 nodeid = report.nodeid 30 if "tests/features/" in nodeid: 31 docstring = getattr(report, "_beehave_docstring", "") or "" 32 else: 33 docstring = "" 34 cells.insert(2, f"<td style='white-space: pre-wrap;'>{docstring}</td>")
Insert the Acceptance Criteria column value for each row.
Args: report: The test report for this row. cells: The list of row cells to modify.