Skip to content

How can tox configuration set virtualenv discovery? #3029

Answered by gaborbernat
bluss asked this question in Q&A
Discussion options

You must be logged in to vote

You should be setting the env var via a plugin, as show in

@impl
def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None: # noqa: U100
env_conf["set_env"].update({"MAGI_CAL": "magi_cal"})
register_inline_plugin(mocker, tox_add_env_config)
ini = """
[testenv]
package=skip
commands=python -c 'import os; print(os.environ["MAGI_CAL"])'
"""
project = tox_project({"tox.ini": ini})
result = project.run("r")
result.assert_success()
assert "magi_cal" in result.out
result_conf = project.run("c", "-e", "py", "-k", "set_env")
result_conf

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bluss
Comment options

@bluss
Comment options

Answer selected by bluss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants