テスト関数の詳細情報としてdocstringをpytest-htmlのレポートに出力する方法をまとめます。 1. conftest.pyを編集 testsディレクトリ直下のconftest.py(なければ作成)に以下の設定を追記します。 テーブルヘッダーの3列目にタイトル、テーブルボディの3列目にテスト関数のdocstringの情報を挿入しています。 import pytest from py.xml import html def pytest_html_results_table_header(cells): cells.insert(2, html.th('Description')) def pytest_html_results_table_row(report, cells): cells.insert(2, html.td(report.description)) @pyte
