I would like to specify a few additional settings in my tox configuration, but only when I'm running on a certain platform.
For example, when running on windows I want an extra environment variable to be defined. I would like to do something like this
[tox]
envlist = env1, env2, env_win32, env_arch
[testenv]
commands=
do stuff...
[testenv]
platform = arch
setenv =
NAME = VALUE
[testenv:env_win32]
plaform = win32
more = stuff
[testenv:env_arch]
platform = arch
more = different_stuff
but this doesn't work because of the duplicate testenv section. I want the specified environment variable to apply to all environments (e.g. env1, env2, env_arch) but not on env_win32.
Note: The specific case that I'm dealing with is that on *nix platforms we need to specify an extra environment variable for install_command
only, so the command includes /usr/bin/env NAME=VALUE
at the beginning. Unfortunately, this doesn't exist on windows which causes it to fail. I want to conditionally define the install_command
differently depending on the platform to get around this.
答案 0 :(得分:0)
[tox]
envlist = env1, env2, env_win32, env_linux
[testenv]
install_command = pip install {opts} {packages}
[testenv-linux]
platform = linux
install_command = /usr/bin/env NAME=VALUE pip install {opts} {packages}
[testenv:env_win32]
plaform = win32
install_command = {[testenv]install_command}
[testenv:env_linux]
platform = linux
install_command = {[testenv-linux]install_command}