[TIP] how to save coverage report output to a file

DZIOBEK, JOE jd5948 at att.com
Thu Jan 17 06:22:27 PST 2019


Hello,

I am executing the "coverage pytest" command sequence below.
We want to save the output of the coverage report command, so that we can then use it later in a SonarScanner command.

How do I save the coverage report output?
In the example below, the -o option works for "coverage xml"
But if I use the same -o option for "coverage report" command, I get the error shown below.

Thanks for your help - Joe


    coverage run -m --source=subfolder  pytest subfolder/test_scriptA.py

    coverage xml -o ./coverage.xml.outfile
    cat ./coverage.xml.outfile # file with contents was created


    coverage report -o ./coverage.report.outfile

ERROR: InvocationError for command 'C:\\Users\\jd5948\\.tox\\py27\\Scripts\\coverage.EXE report -o ./coverage.outfile' (exited with code 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20190117/709aae3c/attachment.html>


More information about the testing-in-python mailing list