Fix bug in conftest script

This fixes below problem when making HTML report file:

  INTERNALERROR> AttributeError: 'CollectReport' object
  has no attribute 'description'

Change-Id: Ie4165f676c6875c28234164024ea18fb265b1e6e
This commit is contained in:
Federico Ressi 2021-05-21 09:03:58 +02:00
parent 4f7e678f95
commit 2e9db6ed31

View File

@ -108,16 +108,17 @@ def pytest_html_results_table_header(cells):
def pytest_html_results_table_row(report, cells):
cells.insert(2, html.td(report.description))
cells.insert(2, html.td(getattr(report, 'description', '')))
cells.insert(1, html.td(datetime.utcnow(), class_="col-time"))
cells.pop()
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call): # pylint: disable=unused-argument
def pytest_runtest_makereport(item, call):
# pylint: disable=unused-argument
outcome = yield
report = outcome.get_result()
report.description = str(item.function.__doc__)
report.description = getattr(item.function, '__doc__', '')
def pytest_html_report_title(report):