[TIP] Can coverage.py be used to collect coverage data for Functional or integration tests?

Rachit Sinha rachit.sinha at nutanix.com
Thu Mar 2 00:55:08 PST 2017


Hi Florian,

Thanks for your response. 

Coming to your 1st Question. Coverage.py can run as an external agent which gets attached to the process for which  coverage data is to be gathered.

The tests will run in background and as the individual lines of code are executed by the tests in the component source code, those lines get recorded by the coverage agent.

I was using a tool – called Jacoco (From EclEmma) which creates a JAVA agent that attaches itself to the JVM. So when external tests execute the component, the data is collected by Jacoco agent.

I was looking something similar to that for python.

For the 2nd Question -

Can coverage.py work with an external framework? Our company has its own command line tests framework.

So can coverage.py be integrated with it?

If so, can you or anyone share with me the procedure for the same?

Thanks,
Rachit


On 02/03/17, 1:17 PM, "Florian Bruhin" <me at the-compiler.org> wrote:

>* Rachit Sinha <rachit.sinha at nutanix.com> [2017-03-02 07:34:15 +0000]:
>> Any information on this? My project is stuck because of the
>> unavailability of a suitable Python code coverage tool for my
>> requirement.
>
>What you want (collecting coverage without cooperation from the
>process running the tests) doesn't seem possible to me.
>
>How would the coverage "agent" collect coverage from the process under
>test? How would it know what Python lines that has executed?
>
>Also, why can't you generate coverage via coverage.py in your test
>framework?
>
>Florian
>
>-- 
>http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
>   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
>         I love long mails! | http://email.is-not-s.ms/



More information about the testing-in-python mailing list