[MERGE] Add --coverage option to selftest

John Arbash Meinel john at arbash-meinel.com
Thu Dec 6 12:48:01 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
> Hi all,
> 
> I've been thinking selftest ought to have a --coverage option for some time.
> Tonight I finally sat down and wrote it.  It simply uses the trace module from
> the standard library in a pretty simple way (basically the same way that
> Twisted's test runner uses it).  It causes a fair bit of noise on stdout (or
> stderr?) while writing the output at the end of the test run.  Like the
> profiler, it uses sys.settrace so it make the test suite much slower when active
> (and probably doesn't work at the same time as the profiler for that matter).
> Despite the rough corners, I think this is useful enough to merge as is.
> 
> The basic idea is you say “--coverage=/tmp/coverage-output” and then
> /tmp/coverage-output will have a file per module with the source of that module
> annotate with the number of times a line was executed.  If a line was never
> executed, it is highlighted by “>>>>>>”.  Thus you can easily spot gaps in your
> test coverage.  (While the fact that a line *is* executed doesn't necessarily
> mean it is adequately tested, clearly any line that is never executed isn't,
> except in very unusual circumstances).
> 
> -Andrew.
> 
> 

While you may be right that the coverage should be loaded earlier, any coverage
testing is better than 0 coverage. So I'm

BB:approve

If you want to rework it to put the coverage loading earlier, you can, but it
would be nice to get --coverage in.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHV++AJdeBCYSNAAMRAvu0AJ4i09T0iLULBHo5bvIxdmvICkucQACghdQt
9Hh8gfOx6O4ZQe339Hzwj5k=
=+biK
-----END PGP SIGNATURE-----



More information about the bazaar mailing list