简体   繁体   English

Coverage.py:如何为从外壳程序脚本调用的多个python脚本附加结果

[英]Coverage.py: How to append result for multiple python scripts getting called from shell script

I am having shell script which calls multiple python code with argument. 我有shell脚本,该脚本使用参数调用多个python代码。 Now my requirement is to collect the report for the whole project. 现在,我的要求是收集整个项目的报告。 Any idea how to run coverage.py on whole code and generate a consolidated report. 任何想法如何在整个代码上运行coverage.py并生成合并报告。 Below is a high level template of shell script which I am using. 下面是我正在使用的shell脚本的高级模板。 If anyone can guide how to achieve above requirements. 如果有人可以指导如何达到上述要求。

#!/bin/bash

variable=$1
/usr/bin/python python1.py $variable
something blah blah

/xyz/abc/python python2.py $someargument

For multiple python calls from a shell script use append option to append report after each python run. 对于从Shell脚本进行的多个python调用,请使用append选项在每次运行python之后附加报告。

#!/bin/bash

variable=$1
coverage run python1.py $variable
something blah blah

coverage run -a python2.py $someargument

To see the report 查看报告

coverage report -m

Report: 报告:

Name             Stmts   Miss  Cover   Missing
----------------------------------------------
python1.py       97      1    99%   95
python2.py        1      0   100%
----------------------------------------------
TOTAL               98      1    99%

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

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