[TIP] tox "empty" factors for generated environment?

Barry Warsaw barry at python.org
Sun Jan 31 09:55:08 PST 2016


On Jan 31, 2016, at 08:09 AM, holger krekel wrote:

>What about today's possible ...
>
>     envlist = {py34,py35}{,-coverage}{,-pg}

Yes!  That's exactly what I was (poorly) asking for.

>?  I guess it'd be nicer to make {py34,py35}-{,coverage}-{,pg} work as well.

Perhaps, but not necessary.  I'm not sure the {,-factor} syntax is documented,
or if it is I've missed it.  So maybe it just needs to be documented more
visibly in the tox documentation?

Then I think you're right that the only new thing we need is a way to describe
empty factors in the sections.  E.g. now I have:

[tox]
envlist = {py34,py35}{,-coverage}{,-pg}

[testenv]
commands =
    python -m nose2 -v
    coverage: python -m coverage run {[coverage]rc} -m nose2 -v
    coverage: python -m coverage combine {[coverage]rc}
    coverage: python -m coverage html {[coverage]rc}
    coverage: python -m coverage report -m {[coverage]rc}

but that means that when I run -e py35-coverage, it runs the first command
unnecessarily.  With your proposal I could write:

[testenv]
commands =
    !: python -m nose2 -v
    coverage: python -m coverage run {[coverage]rc} -m nose2 -v
    coverage: python -m coverage combine {[coverage]rc}
    coverage: python -m coverage html {[coverage]rc}
    coverage: python -m coverage report -m {[coverage]rc}

and I think that would cover my use case nicely.

Add issue #223 (default envlists and/or env groups) and I'd be a very happy
camper. :)

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


More information about the testing-in-python mailing list