Suppose that we have two tox environment collections {py37,py38}-develop
and {py37,py38}-test
. The develop
environments dependencies include the corresponding test
environment dependencies (for simplicity, additional dependencies and configurations of each environment collection is not shown):
[tox]
envlist = {py37,py38}-{test,develop}
[testenv:{py37,py38}-test]
deps = pytest
commands = pytest tests
[testenv:{py37,py38}-develop]
deps = {[testenv:py?-test]deps} # How to describe python version here?
The current solution is:
[tox]
envlist = {py37,py38}-{test,develop}
[testenv:{py37,py38}-test]
deps = pytest
commands = pytest tests
[testenv:{py37,py38}-develop]
deps =
py37: {[testenv:py37-test]deps}
py38: {[testenv:py38-test]deps}
Also, I know that by using the {envname}
variable we can use the whole environment name, but I cannot extract the py*
part for using inside dependencies variable substitution.
How to describe this dependency without duplication in the develop
environment dependencies section? I also prefer the tox configuration to be complete itself and not enforcing the user to pass additional arguments when running tox.