是否可以允许多个 testenv 标签使用相同的脚本?

Is it possible to allow multiple testenv labels with the same script?

目前我们有多个toxenv这只是一个简单的复制+粘贴代码:

https://github.com/nltk/nltk/blob/alvations-test-tox/tox.ini

[testenv:py2.7.14-jenkins]
basepython = python
commands = {toxinidir}/jenkins.sh
setenv =
    STANFORD_MODELS = {homedir}/third/stanford-parser/
    STANFORD_PARSER = {homedir}/third/stanford-parser/
    STANFORD_POSTAGGER = {homedir}/third/stanford-postagger/


[testenv:py3.5.4-jenkins]
basepython = python3
commands = {toxinidir}/jenkins.sh
setenv =
    STANFORD_MODELS = {homedir}/third/stanford-parser/
    STANFORD_PARSER = {homedir}/third/stanford-parser/
    STANFORD_POSTAGGER = {homedir}/third/stanford-postagger/

[testenv:py3.6.4-jenkins]
basepython = python3
commands = {toxinidir}/jenkins.sh
setenv =
    STANFORD_MODELS = {homedir}/third/stanford-parser/
    STANFORD_PARSER = {homedir}/third/stanford-parser/
    STANFORD_POSTAGGER = {homedir}/third/stanford-postagger/

有没有办法将多个标签分配给同一个 toxenv

例如

[testenv:py3.6.4-jenkins,py3.5.4-jenkins,py3-jenkins]
basepython = python3
commands = {toxinidir}/jenkins.sh
setenv =
    STANFORD_MODELS = {homedir}/third/stanford-parser/
    STANFORD_PARSER = {homedir}/third/stanford-parser/
    STANFORD_POSTAGGER = {homedir}/third/stanford-postagger/

不,但您可以通过以下方式重构您的 tox.ini

[testenv]
commands = {toxinidir}/jenkins.sh
setenv =
    STANFORD_MODELS = {homedir}/third/stanford-parser/
    STANFORD_PARSER = {homedir}/third/stanford-parser/
    STANFORD_POSTAGGER = {homedir}/third/stanford-postagger/

[testenv:py2.7.4-jenkins]
basepython = python

[testenv:py3-jenkins]
basepython = python3

[testenv:py3.5.4-jenkins]
basepython = {[testenv:py3-jenkins]basepython}

[testenv:py3.6.4-jenkins]
basepython = {[testenv:py3-jenkins]basepython}

[testenv] 定义所有部分通用的变量。