Please add a [tox]default_envlist setting

Issue #223 on hold
Barry Warsaw created an issue

Maybe I'm missing something obvious, but I think I want a way to both define a bunch of environments, including some generated ones, but I also want tox-with-no-args to only run a few of them by default.

For example:

[tox]
envlist = py27,py34,coverage-{py27,py34},fast-{py27,py34}

Now, if I run just tox it will run all these tests. But I want to make it easy for my users and CI system to only run a few of those environments by default. So I'd like for tox with no arguments to e.g., only run fast-py27 and fast-py34.

Then, if they say something like tox --all it would run all environments. One thought would be to add something like:

[tox]
envlist = py27,py34,coverage-{py27,py34},fast-{py27,py34}
default_envlist = fast-{py27,py34}

and that would be the no-arg set of environments that get run. --all would ignore default_envlist.

I guess this can work with an explicit -e option and the current default to run all environments, but it's a little less convenient because the set of all environments could change and then I'd have to retool my CI or update my README, etc.

Or is this a dumb idea? ;)

Comments (6)

  1. Holger Krekel repo owner

    I sympathize with the idea.

    Would it make sense to introduce "groups" which you can select with tox -g GROUPNAME where the argument defaults to the "default" group? The groups would be defined with a multiline-option "groups" where you can specify "default" and e.g. "dev", "release" groups.

    I can imagine others might simply want to specify a factor like "tox --select-factor fast". or "tox --select-factor coverage".

    maybe your suggestion is sufficient and i am going a bit overboard, not sure ATM.

  2. Barry Warsaw reporter

    Groups is a pretty neat idea actually. I could imagine you'd have an all group, maybe a smoketest group, possibly a release group. Having a default group would certainly scratch the itch described here. I rather like the --select-factor idea too, but perhaps there's a clever way to turn factors into groups so that it's really just one new feature?

  3. Barry Warsaw reporter

    I've been thinking about this lately and I think I might have an elegant way to define env groups. E.g.:

    [tox]
    envlist =
        default: py34,py35
        all: {py34,py35}-{,-coverage,-diffcov},{-pg}
        ci: py35
        merges: {py34,py35}-diffcov
    

    and so on. Then if you run tox it will be as if you ran tox -g default. If you run tox -e py35 it would not run any group, so -e and -g would be mutually exclusive. If you have only envlist = py34,py35 for example (i.e. no explicit groups), then that's as if you defined the default group.

    It borrows the syntax for generated environments, but it seems pretty intuitive. What do you think?

  4. Log in to comment