alvas
alvas

Reputation: 122052

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

Currently we have multiple toxenv that's just a simple copy+paste code:

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/

Is there someway to assign multiple label to the same toxenv?

E.g.

[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/

Upvotes: 0

Views: 759

Answers (1)

phd
phd

Reputation: 94473

No, but you can refactor your tox.ini the following way:

[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] defines variables common to all sections.

Upvotes: 1

Related Questions