[TIP] Coverage 3.4: modules in "source" but file patterns in "omit"?

Marius Gedminas marius at gedmin.as
Wed Nov 17 09:28:41 PST 2010


On Wed, Nov 17, 2010 at 08:29:12AM -0500, Ned Batchelder wrote:
> The specification of source files has changed over time, and there
> are lots of different use cases, so it's hard to get it just right
> for everyone.  One possibility is to allow referring to modules by
> module name in the omit (and include) settings.  This is a little
> more involved than it seems at first blush, though, because we only
> really know what module names mean when we're executing the code.

You can do a reasonable job converting filenames to dotted module names
if you follow parent directories until you find one without __init__.py.

This requires access to the source tree, though, which is fine for
'coverage html' but perhaps not so fine for 'coverage report'.

(For the record, filename-based patterns for both --include and --omit
work well enough for me, especially given that * matches an arbitrary
number of subdirectories.)

Marius Gedminas
-- 
   Since this protocol deals with Firewalls there are no real security
   considerations.
                -- RFC 3093
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20101117/d1614c8b/attachment.pgp>


More information about the testing-in-python mailing list