Allow wildcards to be used in TOXENV and with the `-e` option

Issue #318 on hold
Ed Morley created an issue

Currently it's not possible to use wildcards with TOXENV and/or the -e option.

For example, I'd like to be able to use:

export TOXENV=py27-*

... to just run the python 2.7 subset of the peep tox config: https://github.com/erikrose/peep/blob/daa9e87014de1f907fac446f89b9d849665a649e/tox.ini#L8-L9

However since wildcards aren't supported, I've had to resort to a bit of a hack to generate the TOXENV in the Travis config:

export TOXENV=`tox --listenvs | grep "py${TRAVIS_PYTHON_VERSION/./}-" | tr '\n' ','`

See: https://github.com/edmorley/peep/commit/bb77b96dfd548dd3ba9ac1c595c047dbd3e7f8a9

Many thanks :-)

Comments (6)

  1. Holger Krekel repo owner

    As far as command line options go i'd rather like a -f FACTOR option to select all env names which have the factor. True enough, that wouldn't help with TOXENV so maybe wildcarding is the more general solution. Are you up for a PR with tests and docs that introduces wildcard-matching (fnmatch-style) for -e and TOXENV?

  2. Ed Morley reporter

    Sorry for the delay in replying. Agree that due to TOXENV wildcarding may be the better solution. I've not had a spare moment yet, but will try to double back to this at some point.

    I've also spotted there's a dupe issue #22, albeit there's less discussion there, so might be worth forward-duping.

  3. Eli Collins

    Instead of a -f FACTOR option, perhaps if it was implemented so that -f simply changed the behavior of -e and -l to do factor matching? That way it would be possible to use -fl FACTOR to see what environments would be run by -fe FACTOR.

    If that were also combined with some flag to make -l output a single-line csv (e.g. "--list-csv"), It would also make Ed's environment string reduce to export TOXENV='tox --list-csv -fl py${TRAVIS_PYTHON_VERSION/./}'

  4. Eli Collins

    If it helps, attached is the quick-n-dirty helper script that I've been using to solve a similar problem. Usage is toxmatch.py <FACTORS>

  5. Log in to comment