From 2e9db6ed3157cfcdf78033a1e77cdf2dd0c0cbff Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 21 May 2021 09:03:58 +0200 Subject: [PATCH] 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 --- tobiko/tests/conftest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tobiko/tests/conftest.py b/tobiko/tests/conftest.py index 86220421a..a0ad67f9f 100644 --- a/tobiko/tests/conftest.py +++ b/tobiko/tests/conftest.py @@ -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):