[TIP] Reporting coverage for changed lines of code

Frank Niessink frank at niessink.com
Wed Apr 25 10:00:53 PDT 2012


I was doing some refactoring in a code base with reasonable but not
perfect unit test coverage. While reviewing my changes I was
wondering: of the lines changed, which ones are not covered by unit
tests? If I had a report showing just that, I could make sure that
whenever I commit a change, the unit test coverage for the changed
lines would be 100%. Thus continuously improving overall coverage and
reducing the risk of changes at the same time. Wouldn't that be neat?

This started out as conversation on twitter (see
https://twitter.com/#!/fniessink/status/195166296848072704) with Ned
Batchelder because I was thinking that this would be an excellent
feature for coverage.py . What do you guys think?

Thanks, Frank

More information about the testing-in-python mailing list