[TIP] Getting combined coverage with Tox

Carl Meyer carl at oddbird.net
Fri Jun 5 10:53:35 PDT 2015


Hi André,

On 06/04/2015 10:15 PM, André Caron wrote:
> I thought it would be somewhat easier to manage the list of environment
> names if we could specify them on multiple lines, so I sent in a quick
> pull request (#163) to add support for this.  Please let me know what
> you think!

Multi-line envlist is already possible (because multi-line settings are
built in to the ConfigParser format), you just aren't allowed to omit
the commas. Here's a typical tox.ini for me which uses a multi-line
envlist:
https://github.com/carljm/django-transaction-hooks/blob/master/tox.ini

Regarding the larger question about needing to explicitly specify
envlist, your approach to tox.ini feels backwards from what I usually
use. I see envlist as the required canonical listing of all envs, and
`testenv:...` sections as only needed for special cases. Now that we
have the new environment components support (which you can see used
extensively in the above tox.ini), I rarely have specific `testenv:...`
sections at all, often just the envlist and then the generic `testenv`
section.

And regarding measuring coverage with tox, I don't bother with separate
coverage files or combining, I just use `coverage run -a ...` as the
test command. The downside of this is that it doesn't automatically
erase before a run or automatically report after a run. I usually handle
this just by scripting tox instead of running it directly; either on CI
or locally via a Makefile.

HTH,

Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20150605/d22bcff7/attachment.pgp>


More information about the testing-in-python mailing list