[py-dev] pytest-cov measuring multiple subprocesses? (+notes)

holger krekel holger at merlinux.eu
Wed Aug 4 12:39:08 CEST 2010


Hi Meme,

i am using pytest-cov for a project where I start multiple subprocesses. 
I am wondering how to best do this, here is the scenario: 

    def test_functional():
        popen1 = subprocess.Popen(...) # new python process
        popen2 = subprocess.Popen(...) # new python process
        popen1.terminate()
        popen2.wait()


and now i want pytest-cov to show me the coverage. 
What do i need to do?  Should it "just" work with this:
 
    py.test --cov=mypkg 

?  

An unrelated note: the py.test distributed coverage-reporting feature 
("DistMaster" etc.) is living with cov_core.py IISIC. Is this actually re-usable
from nosetests?  If not it would probably make more sense to have this code in
pytest-cov for it to be easier to modify and maintain, no? 

another unrelated note: i like plugins to not cause import overhead if
their functionality is not actually used.  What about importing cov_core 
only when coverage is actually active? 
:)

best,
holger



More information about the Pytest-dev mailing list