Merge 8401373925
into 4b88ee41bd
This commit is contained in:
commit
fbb143f8b3
|
@ -157,8 +157,8 @@ class BaseReport:
|
||||||
|
|
||||||
def _hydrate_data(self, data, cells):
|
def _hydrate_data(self, data, cells):
|
||||||
for index, cell in enumerate(cells):
|
for index, cell in enumerate(cells):
|
||||||
# extract column name and data if column is sortable
|
table_len = len(self._report.table_header)
|
||||||
if "sortable" in self._report.table_header[index]:
|
if index < table_len and "sortable" in self._report.table_header[index]:
|
||||||
name_match = re.search(r"col-(\w+)", cell)
|
name_match = re.search(r"col-(\w+)", cell)
|
||||||
data_match = re.search(r"<td.*?>(.*?)</td>", cell)
|
data_match = re.search(r"<td.*?>(.*?)</td>", cell)
|
||||||
if name_match and data_match:
|
if name_match and data_match:
|
||||||
|
@ -180,6 +180,16 @@ class BaseReport:
|
||||||
|
|
||||||
@pytest.hookimpl(trylast=True)
|
@pytest.hookimpl(trylast=True)
|
||||||
def pytest_sessionfinish(self, session):
|
def pytest_sessionfinish(self, session):
|
||||||
|
generate_with_tags = session.config.getoption("generate_reports_with_tags")
|
||||||
|
self._report.set_data("environment", self._generate_environment())
|
||||||
|
session.config.hook.pytest_html_report_title(report=self._report)
|
||||||
|
if generate_with_tags:
|
||||||
|
headers = self._report.table_header
|
||||||
|
session.config.hook.pytest_html_results_table_header(cells=headers)
|
||||||
|
self._report.table_header = _fix_py(headers)
|
||||||
|
self._report.running_state = "started"
|
||||||
|
self._generate_report()
|
||||||
|
|
||||||
session.config.hook.pytest_html_results_summary(
|
session.config.hook.pytest_html_results_summary(
|
||||||
prefix=self._report.additional_summary["prefix"],
|
prefix=self._report.additional_summary["prefix"],
|
||||||
summary=self._report.additional_summary["summary"],
|
summary=self._report.additional_summary["summary"],
|
||||||
|
|
|
@ -48,6 +48,11 @@ def pytest_addoption(parser):
|
||||||
default=[],
|
default=[],
|
||||||
help="append given css file content to report style file.",
|
help="append given css file content to report style file.",
|
||||||
)
|
)
|
||||||
|
group.addoption(
|
||||||
|
"--generate_reports_with_tags",
|
||||||
|
action="store_true",
|
||||||
|
help="the HTML report will be generated while running with tags",
|
||||||
|
)
|
||||||
parser.addini(
|
parser.addini(
|
||||||
"render_collapsed",
|
"render_collapsed",
|
||||||
type="string",
|
type="string",
|
||||||
|
|
Loading…
Reference in New Issue