[TIP] nosetests with coverage excluding a package

Joesan Gabaldon joesan.gabaldon at gmail.com
Tue Jul 19 21:22:11 PDT 2011

We have a script that launches both servers using Popen but only one is
measured.  So the sequence of the commands for the testsuite are:

    python ignition.py --start-with-pylonsserver

    nosetests -v thisproject/tests_folder --with-coverage --with-xunit
    coverage xml --include=thisproject/* --omit=./thisproject/tests_folder/*

    python ignition.py --kill

I saw that subprocess page but didn't look into it much since that one
server is getting checked.  I'll look into it in the morning though, along
with the debug command.  Are there any conditions where coverage would
ignore certain folders/packages by default?

(Ned sorry for the double email, forgot to hit "reply all")

- Joesan

On Tue, Jul 19, 2011 at 10:22 PM, Ned Batchelder <ned at nedbatchelder.com>wrote:

> **
> 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:
> http://nedbatchelder.com/code/coverage/subprocess.html
> --Ned.
> 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 listtesting-in-python at lists.idyll.orghttp://lists.idyll.org/listinfo/testing-in-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110720/f0fbda3d/attachment.htm>

More information about the testing-in-python mailing list