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 :-)
Original comment by @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>
Original comment by @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/./}'
Original comment by @edmorley
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.
Original comment by @hpk42
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?
Since this issue got moved to git, I'm reuploading the script I've been using, if anyone finds it useful (as code source, or just as is):
toxmatch.py -- https://gist.github.com/eli-collins/ef91add2bc635ccaf61738cd805cb18b
this would be great
I've created tox-factor, which allows for matching on specific factors. So, instead of
tox -e py37-*
you would run
tox -f py37
or
TOXFACTOR=py37 tox
Most helpful comment
I've created tox-factor, which allows for matching on specific factors. So, instead of
you would run
or