AttributeError: ‘TestReport’ object has no attribute ‘description’
在conftest文件增加报告描述,如下:
@pytest.mark.optionalhook
def pytest_html_results_table_header(cells):
cells.insert(2, html.th('Description'))
cells.insert(1, html.th('Time', class_='sortable time', col='time'))
cells.pop()
@pytest.mark.optionalhook
def pytest_html_results_table_row(report, cells):
cells.insert(2, html.td(report.description))
cells.insert(1, html.td(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), class_='col-time'))
cells.pop()
但是运行后会报错误,AttributeError: ‘TestReport’ object has no attribute ‘description’:
Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/jiekou/testcase/test_login.py", line 24, in <module>
pytest.main(<