[TIP] coverage reporting

David Dahl ddahl at ilm.com
Thu Aug 2 09:38:35 PDT 2007


Hello testers.

(hi JP, Terry and Kumar, hows it goin?)

I am currently converting a bunch of tests that were originally written 
with the Twisted unittest module to use nose and coverage.py and/or 
figleaf. The nose/coverage.py reports looks great, but when I use 
figleaf it seems like the (html) report generated is doing coverage on 
the tests and not the package I am testing. here is how I am invoking it:

-----------------------------------------
import sys

import figleaf
import nose

args = sys.argv

figleaf.start()

nose.run(argv=args)

figleaf.stop()

figleaf.write_coverage('.figleaf')
--------------------------------------
usage:

python nose_figleaf_coverage.py -vv *_nose.py
/home/ddahl/python/usr/bin/figleaf2html -d ~/figleaf_reports/ .figleaf

Here is what it looks like in the figleaf report:

Filename 	# lines 	# covered 	% covered
*totals:* 	*13594* 	*7530* 	*55.4%*
/home/ddahl/ddahl_loisdev/lois/test/test_lois_storage_contenttype_nose.py 
<cid:part1.02010106.05080404 at ilm.com> 	12 	12 	100.0


The coverage.py report makes no mention of the test files:

Name                             Stmts   Exec  Cover   Missing
--------------------------------------------------------------
lois                                 0      0   100%
lois.content                         0      0   100%
lois.content.base                   65      0     0%   11-104
lois.content.rstcontent            485      0     0%   11-786

How am I abusing figleaf?


-- 
David Dahl

Content Management Software Engineer

Industrial Light + Magic

415-746-3890




More information about the testing-in-python mailing list