测试覆盖报告未通过子进程模块正确生成
我正在使用Pycov生成我开发的Python工具的覆盖范围报告。
工作流♻: - 测试脚本 - >辅助文件的调用函数(使用 subprocess 与 tool.py.py ) - > stdout 退回并将其返回到测试脚本
。
获取 > 即使是在测试阶段击中的代码块,它们也被显示为在Pycov生成的覆盖范围报告中没有涵盖。
此脚本运行所有测试脚本。
for i in file_list:
if i.startswith("test_"):
test_files.append(i)
for file in test_files:
result_file_name = file.split(".")[0] + ".xml"
pytest.main([file, "-o", "junit_logging=system-out","--disable-pytest-warnings",
"--junitxml=" + result_folder + result_file_name, "--tb=line",
"--cov", "--cov-config=.coveragerc", "--cov-report=html", "--cov-report=", "--cov-append"])
在.coveragerc文件中,
[run]
branch = True
dynamic_context = test_function
include = Tool.py
有人知道解决方案吗?请让我知道,谢谢!
I'm using pycov to generate the coverage report for a python tool that I've developed.
Workflow ♻:- Test Script -> Calls function from Helper File (Uses Subprocess to interact with Tool.py) -> Gets the stdout back and returns it to the test script.
⭐Coverage report needs to be generated for Tool.py
Even the the codeblocks are hit during the testing phase, they are being shown as not being covered in the coverage report generated in pycov.
This script runs all the test scripts.
for i in file_list:
if i.startswith("test_"):
test_files.append(i)
for file in test_files:
result_file_name = file.split(".")[0] + ".xml"
pytest.main([file, "-o", "junit_logging=system-out","--disable-pytest-warnings",
"--junitxml=" + result_folder + result_file_name, "--tb=line",
"--cov", "--cov-config=.coveragerc", "--cov-report=html", "--cov-report=", "--cov-append"])
In the .coveragerc file
[run]
branch = True
dynamic_context = test_function
include = Tool.py
Does anybody know a solution for this? Please do let me know, thanks!????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论