У меня есть файл conftest.py в папке, где находятся тесты .py.
Код: Выделить всё
import pytest
from py.xml import html
@pytest.mark.optionalhook
def pytest_html_results_table_header(cells):
cells.insert(2, html.th('Custom Description'))
@pytest.mark.optionalhook
def pytest_html_results_table_row(report, cells):
custom_description = getattr(report, "custom_description", "")
cells.insert(2, html.td(custom_description))
@pytest.fixture(scope='function')
def custom_description(request):
return request.function.__doc__
def test_001(custom_description, request):
print('Это тест 1')
assert Truerequest.node.report_custom_description = "Это проверка входа"
Код: Выделить всё
def test_002(custom_description, request):
print('This is test 2')
assert True
request.node.report_custom_description = "This is user name test"
Я пытался удалить пустую кавычку в custom_description = getattr(report, "custom_description", ""), но это выдает ошибку.
Любая помощь будет очень признательна.
Подробнее здесь: https://stackoverflow.com/questions/757 ... tml-report