Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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. Below is a high level template of shell script which I am using. 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
like image 641
Rishi Bansal Avatar asked Sep 04 '26 08:09

Rishi Bansal


1 Answers

For multiple python calls from a shell script use append option to append report after each python run.

#!/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%
like image 71
pradeep Avatar answered Sep 05 '26 22:09

pradeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!