Skip to content

tox4: env substitution does not uses values from set_env #1779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
astrojuanlu opened this issue Jan 8, 2021 · 4 comments
Closed

tox4: env substitution does not uses values from set_env #1779

astrojuanlu opened this issue Jan 8, 2021 · 4 comments
Labels
bug:normal affects many people or has quite an impact tox4
Milestone

Comments

@astrojuanlu
Copy link

Configuration:

$ cat tox.ini 
[testenv]
skip_install = True
allowlist_externals =
    /bin/echo
setenv =
    MSG = "Normal tests"
    fast: MSG = "Only fast tests"
commands =
    echo {env:MSG}

tox 3:

$ python -m tox -e py3
py3 run-test-pre: PYTHONHASHSEED='561195256'
py3 run-test: commands[0] | echo 'Normal tests'
Normal tests
___________________________________________ summary ___________________________________________
  py3: commands succeeded
  congratulations :)
$ python -m tox -e py3-fast
py3-fast run-test-pre: PYTHONHASHSEED='3471543899'
py3-fast run-test: commands[0] | echo 'Only fast tests'
Only fast tests
___________________________________________ summary ___________________________________________
  py3-fast: commands succeeded
  congratulations :)

tox 4:

$ python -m tox -e py3
py3: commands[0]> echo

py3: OK ✔ in 0.04 seconds
  py3: OK (0.04=setup[0.04]+cmd[0.00] seconds)
  congratulations :) (0.07 seconds)
$ python -m tox -e py3-fast
py3-fast: commands[0]> echo

py3-fast: OK ✔ in 0.04 seconds
  py3-fast: OK (0.04=setup[0.04]+cmd[0.00] seconds)
  congratulations :) (0.07 seconds)
@astrojuanlu astrojuanlu added the bug:normal affects many people or has quite an impact label Jan 8, 2021
@gaborbernat
Copy link
Member

Thanks for the report. It seems the commands are evaluated before the setenv part, hence though the command is run in a subprocess with that environment variable set, it does not actually is populated within the executed commands argument list.

@gaborbernat gaborbernat changed the title tox4: setenv has no effect tox4: env substitution does not uses values from set_env Jan 9, 2021
@gaborbernat
Copy link
Member

Resolved via #1784

@astrojuanlu
Copy link
Author

I confirm the fix 👍🏽

@gaborbernat
Copy link
Member

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
@gaborbernat gaborbernat added this to the 4.0 milestone Jan 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug:normal affects many people or has quite an impact tox4
Projects
None yet
Development

No branches or pull requests

2 participants