tox
tox copied to clipboard
tox needs an option to unset environment variables to complement passenv
Currently there is no option to tell tox to passenv FOO_*
with exceptions FOO_BAR
and if you are unlikely enough to have to deal with a tool for which unset
and set-as-empty-string has different behavior you are kinda out of options.
Instead of adding new options it could be easier if we would have magic value on setenv
which unsets variables, taking precendence of use of wildcard on passwenv.
I initially asked on https://stackoverflow.com/questions/57293456/how-do-i-unset-an-environment-variable-with-python-tox but apparently there is no way to achieve that now.
Not sure I see this under core, if anything would need some time as a plugin to mature and maybe after then 🤔
@gaborbernat it is clearly related to passenv
and setenv
and I do not see any reasons for not being address by them. How is implemented is a detail, but it matters to allow user to blacklist.
If wildcards from passenv could accept regexes we could add a negative match.
Maybe a {omit}
tag could make sense?
Or maybe you have another idea?
I would prefer it outside of core just because of seems rare and complicated enough that does not warrant complicating the interface for new users.
On reflection here for this, we'd want a disallow_pass_env
that gets applied just before set_env (so post glob expansion).
@gaborbernat To avoid adding a new configuration item, I was wondering if this could be implemented using a prefixed entry in passenv or setenv like !FOO
or -FOO
for the values that are not expected to be passed.
I'd prefer a new configuration than this conflating syntax. PR welcome.