pytest-html生成的报告路径问题

zaigua / 2024-09-20 / 原文

查看 pytest 的配置文件 pytest.ini

查看代码
 [pytest]
addopts = -vs --html=./reports/report.html

确保 --html 选项的路径是你期望的路径。

路径 ./reports/report.html 是相对于运行 pytest 命令的当前工作目录的。

如果你从某个子目录运行 pytest,报告将会生成在相对于该子目录的路径下。