I can't change the test case names in the html report Based on this I have the following code in my conftest file:
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
test_fn = item.obj
docstring = getattr(test_fn, '__doc__')
if docstring:
report.nodeid = docstring
@pytest.mark.optionalhook
def pytest_html_results_table_row(report, cells):
for cell in cells:
if cell.attr.class_ == "col-name":
if hasattr(report, "docstring"):
cell[0] = report.docstring
break
And the following code in a test case:
def test_demo_server(self):
self.test_demo_server.__doc__ = "TEST"
I get the following error: AttributeError: attribute 'doc' of 'method' objects is not writable
I'm not sure how to proceed from here.