Description
Hi again! I'd like to propose a feature to tox.
It would be convenient to have a single testenv with platform-dependent commands. This can be done to some extent with tox already:
[testenv]
platform = win32
commands = python -c 'import sys; print(sys.platform)'
Then we can have an environment for each platform. This would be ok for running tox without any arguments, but for running tasks manually, i.e. tox -e task
, this is way worse because the user needs to remember the command for their specific platform, for example tox -e task-win
. In this Stack Overflow question I attempted to make a single environment that could run platform-dependent commands, but was not successful. I'll summarise it here to provide syntax that I would have expected to work. Either one should be able to define the platforms independently in all test environments:
[tox]
envlist = task
[testenv:task]
platform =
linux: linux
mac: darwin
win: win32
commands =
linux: python -c 'print("Linux")'
mac: python -c 'print("Mac")'
win: python -c 'print("Win")'
Or defining the platforms in the top level testenv would be fine as well:
[tox]
envlist = task
[testenv]
platform =
linux: linux
mac: darwin
win: win32
[testenv:task]
commands =
linux: python -c 'print("Linux")'
mac: python -c 'print("Mac")'
win: python -c 'print("Win")'
Please don't hesitate to close this issue if it's already a thing in tox 4, or if I'm simply doing something wrong. Also, I'd be fine with this being introduced in tox 4 instead of the 3.x series, because it's already on the way.