vendredi 31 janvier 2020

Running tox with different environment variable config

I want to run my test with different values of environment variables. I have this tox.ini, which doesn't do what I want:

# tox.ini

[tox]
envlist = py37-{foo,bar}

[testenv]
description = Tests common
setenv =
    MY_VAR=COMMON
commands =
    env

[testenv:foo]
description = Tests foo
setenv =
    MY_VAR=FOO

[testenv:bar]
description = Tests bar
setenv =
    MY_VAR=BAR 

Above ini produced the following output:

$ tox
GLOB sdist-make: 

***

py37-foo run-test: commands[0] | env

***

MY_VAR=COMMON                                 <<<--- MY_VAR=foo is expected

***

py37-bar run-test: commands[0] | env

***

MY_VAR=COMMON                                 <<<--- MY_VAR=bar is expected

Whats wrong?

I use:

  • Win 10.0.18363 Build 18363
  • Python 3.7.4
  • tox: 3.14.0

Aucun commentaire:

Enregistrer un commentaire