piranha/opster — pull request #8 by oscarbenjamin (2012-01-03 13:29:22+00:00)
Title: Added support for coverage with cram tests

Hi again.

I'm just beginning to understand how cram works. I wondered how to perform test coverage measurement. Does opster already have a test coverage scheme? This patch implements coverage measurement, using Ned Batchelder's coverage.py, like so:

$ coverage erase
$ COVERAGE=1 cram opster.t
.
# Ran 1 tests, 0 skipped, 0 failed.
$ coverage report
Name Stmts Miss Branch BrPart Cover
---------------------------------------------------------------------------
/stuff/oscar/work/current/opster/opster 418 77 201 32 82%
hello 5 0 2 0 100%
multicommands 43 10 14 2 79%
multivalueserr 6 0 0 0 100%
selfhelp 6 1 2 1 75%
test_opts 5 0 0 0 100%
---------------------------------------------------------------------------
TOTAL 483 88 219 35 82%

You can also do ```coverage html``` to generate the html files annotating the code in the ```tests/htmlcov``` directory.