[TIP] nosetests with coverage excluding a package

Ned Batchelder ned at nedbatchelder.com
Tue Jul 19 19:22:08 PDT 2011

To get coverage measurement of subprocesses, you need to take some extra 
steps, unless I'm missing something you're doing in the description 
below.  Are both servers started with Popen?  And one is measured and 
the other is not?  You can check on measurement with the "coverage debug 
data" command, which will show you a summary of the data collected 
during the last run.

There's a page in the docs about getting subprocesses measured: 


On 7/19/2011 6:25 PM, Joesan Gabaldon wrote:
> Hey all, I've been trying to figure this out on and off for a couple 
> months now (it hasn't really been priority until recently) and I could 
> really use some help fixing this.
> I'm running a system which requires 2 serves to run, one of them being 
> a pylons project.  For some reason coverage doesn't seem to be 
> checking any of the files in the pylons server.  I have a script which 
> launches both servers using Popen, with the pylons server launched 
> with the shell command "paster serve development.ini".
> Nosetests & coverage are launched with:
>     nosetests -v thisproject/tests_folder --with-coverage --with-xunit 
> --xunit-file=./nosetests.xml
>     coverage xml --include=thisproject/* 
> --omit=./thisproject/tests_folder/*
> I've also tried explicitly telling the coverage report to include the 
> pylons folder which is located at "thisproject/clients/pylons_server":
>     coverage xml 
> --include=thisproject/*,thisproject/clients/pylons_server 
> --omit=./thisproject/tests_folder/*
> But that doesn't seem to work, I suspect because that folder is never 
> even executed when nosetests is running the tests.  The functions are 
> definitely getting executed though as those tests pass, and other 
> files in the clients folder and subdirectories of clients are getting 
> included in the coverage report.  Anyone have any ideas?
> Joesan
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110719/9133710a/attachment.htm>

More information about the testing-in-python mailing list