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.
Original comment by @nedbat
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.
Wow. So we have tox, detox, retox (recursive tox) and maybe gtox (grouped tox). I have no opinion about this yet, so just marking it as a potential enhancement for now.
Please also see #223 for some further ideas on the topic.
So one of the things from #223 that's important I think is that there be a "default" group that gets run when you say tox with no other options. The other idea from there was that you could say tox -g grouname to run that group's environments.
I'm started to really like this idea. I think it nicely solves #418 too (at least, my motivating use case for that issue).
Any update on this? I have a much simpler use case: I just need an alias because we refactored a "pep8" environment into a more generic "linters" and it would be very convenient to be able to give aliases for people that are still in the habbit of doing "tox -e pep8".
Now I am using placeholder environments but this is too verbose, a real alias would be better.
I think blocked mostly on help wanted for now. Aka people available to implement it.
Most helpful comment
I think blocked mostly on help wanted for now. Aka people available to implement it.