-
-
Notifications
You must be signed in to change notification settings - Fork 541
Open
Labels
Description
What's the problem this feature will solve?
I want to set an environment conditionally based on another environment variable, in my case
MATURITY = TAG_NAME ? 'production' : 'testing'
Currently, the substitutions only support the following features
FOO = {env:KEY:DEFAULTVALUE}: SetsFOOtoenv:KEYif defined, otherwise toDEFAULTVALUEFOO = {env:KEY:}: SetsFOOtoenv:KEYif defined, otherwise to an empty string
Describe the solution you'd like
[testenv]
setenv =
MATURITY = {env:TAG_NAME ? 'production' : 'testing'}Alternative Solutions
I could use a toxfile.py with
from os import environ
from tox.config.sets import EnvConfigSet
from tox.plugin import impl
from tox.session.state import State
@impl
def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None:
env_conf["set_env"].update(
{"MATURITY": "production" if environ.get("TAG_NAME") else "testing"},
)But I'd rather use plain tox.ini syntax.
Additional context
N/A