[TIP] Make tox and coverage play together more nicely?

Barry Warsaw barry at python.org
Fri Nov 21 09:22:15 PST 2014


On Nov 16, 2014, at 12:16 PM, Ned Batchelder wrote:

>If I understand you correctly, this would require coverage to automatically
>understand that .../site-packages/mailman is your own code.  I don't see how
>it could do that.

Yes, it would have to know that `foo` and
.tox/{envname}/lib/pythonX.Y/site-packages/foo were the same code

It would be nice if 'pythonX.Y' were automatically detected, but I don't think
that's a variable directly available from tox, so it would have to be
calculated, probably from {envpython}.

>> I also don't like having to explicitly omit everything else in the tox
>> venv's site-packages.  It seems like since coverage already omits stuff in
>> the system's site-packages, it could do the same with the tox venv
>> site-packages.
>
>Usually the best way to omit things from site-packages is to use the
>--source=. (or some other value) setting.  In your case, it looks like it
>would be:
>
>     [run]
>     source =
>         .
>         .tox/coverage/lib/python*/site-packages/mailman
>
>Would that work?

I'm not sure!  I definitely get different coverage numbers, with more holes
than I'd expect, but I am going to have to spend more time to investigate
whether they are legitimate coverage misses or not.  Still, thanks for the
recommendation!

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20141121/e7f8d620/attachment.pgp>


More information about the testing-in-python mailing list