此时我们只需要在conftest文件下加如下钩子函数就可以完美解决:
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
report.description = str(item.function.__doc__)
report.nodeid = report.nodeid.encode("utf-8").decode("unicode_escape") # 设置编码显示中文
标签:description,no,attribute,pytest,报错,report
From: https://www.cnblogs.com/longronglang/p/16971388.html