github操作pytest失败过程以及将其保存到txt文件
我正在尝试设置工作流程,该工作流程运行测试和评论测试覆盖范围。为了实现这一目标,我需要将PYTest调用结果保存到TXT文件中。但是,通过以下命令这样做:
运行pytest -cov =。/ --- junitxml = pytest.xml - capture = tee-sys -cov-report =术语=术语 - 验证术:跳过覆盖的测试/ test_app .py | Tee Pytest-cover.txt
我会遇到一个问题,如果某些测试失败,则整个工作流程都会完成。我想要的是如果任何测试失败,工作流都会失败,否则我将使用pytest-coverage.txt打印代码覆盖范围。
I am trying to set up workflow, which runs tests and comments test coverage. To achieve that, I need to save pytest call results into txt file. However, by doing so with following command:
Run pytest --cov=./ --junitxml=pytest.xml --capture=tee-sys --cov-report=term-missing:skip-covered tests/test_app.py | tee pytest-coverage.txt
I run into a problem, when if some tests fail whole workflow finishes anyway. What I want is workflow failing if any of the tests fail, otherwise I will use pytest-coverage.txt to print code coverage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要设置
PipeFail
:因此,工作流步骤应该是:
注意:
shell
在作业默认值。You might need to set
pipefail
:So the workflow step should be:
Notes:
shell
in job defaults.