1. Holger Krekel
  2. tox
  3. Issues

Issues

Issue #238 on hold

group envs into an alias

Michael Merickel
created an issue

We have always used tox to run our coverage commands. However recently we started running coverage on py2 and py3 and combining it into a single coverage report that should be 100%.

Anyway, this is done using 3 environments. One for py2, one for py3 and one to aggregate the results.

This is all fine but the interface has changed from tox -e cover to tox -e py2-cover,py3-cover,cover. Ideally tox would possibly support some sort of grouping instead of requiring us to wrap this invocation in something else.

But wait, we found a scary solution!

[testenv:py2-cover]
commands =
    coverage run ...
setenv =
    COVERAGE_FILE=.coverage.py2

[testenv:py3-cover]
commands =
    coverage run ...
setenv =
    COVERAGE_FILE=.coverage.py3

[textenv:cover]
commands =
    coverage erase
    tox -e py2-cover
    tox -e py3-cover
    coverage combine
    coverage xml
setenv =
    COVERAGE_FILE=.coverage
deps =
    tox

A recursive tox file! Anyway this has some downsides like tox -r is not propagated downward to the sub-toxes. However this solves our issues with the CLI, and even gives us the opportunity to do things prior to the sub-toxes like erase without introducing yet another tox env.

I don't have an actual proposal but I wanted to open an issue and get some thoughts on possible solutions inside or outside of tox.

Comments (3)

  1. Ned Batchelder

    I have a similar need. My idea would be to have "tox -e cover" mean, run all the envs with a "cover" factor in them.

    Just as a configuration line like "cover: foo" applies to all envs with a cover factor, "-e cover" means, run all of those envs.

    I would find this very helpful. It would let me test all of my py27 runs, or all of my pytracer runs with a simple invocation.

  2. Log in to comment