简体   繁体   English

如何在程序中使用pytest-html生成html报告和IDE PyCharm?

[英]How do you use pytest-html in a program to generate a html report and the IDE PyCharm?

I'm launching my test from PyCharm, and once it finishes I want to create a report.我正在从 PyCharm 启动我的测试,一旦完成,我想创建一个报告。 How can I do that in my code?我怎样才能在我的代码中做到这一点?

I saw the pytest_html module but I have only see a command ( pytest --html=report.html --self-contained-html ) to put on cmd.exe , and I want to know how to do thaht directly in my program?只见pytest_html模块,但我只看到一个命令( pytest --html=report.html --self-contained-html )穿上CMD.EXE,我想知道如何直接在我的计划做thaht?

在编辑配置中添加--html = Reports / Report.html此为其他农产品

One option would be:一种选择是:

import subprocess
subprocess.run("pytest --html=report.html --self-contained-html",shell=True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM