Skip to content
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

Documentation how per-platform commands work needs improvement #1144

Closed
mks-m opened this issue Jan 19, 2019 · 5 comments · Fixed by #1753
Closed

Documentation how per-platform commands work needs improvement #1144

mks-m opened this issue Jan 19, 2019 · 5 comments · Fixed by #1753
Assignees
Labels
area:documentation bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. level:easy rought estimate that this might be quite easy to implement

Comments

@mks-m
Copy link

mks-m commented Jan 19, 2019

python version: 3.6
python sys.platform: darwin
tox version: 3.5.3

tox.ini content:

[tox]
envlist=py36
skipsdist=True

[testenv]
platform= macos: darwin
          linux: linux

commands=
  macos: echo macos
  linux: echo linux

tox invocation:

~/dev/tox-test % tox
py36 create: ~/dev/tox-test/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='3999618367'
________________________________________________________________________________________ summary ________________________________________________________________________________________
  py36: commands succeeded
  congratulations :)
@obestwalter
Copy link
Member

obestwalter commented Jan 19, 2019

Hi @keymone. I see where this is confusing.

The docs say:

A testenv can define a new platform setting as a regular expression. If a non-empty expression is defined and does not match against the sys.platform string the test environment will be skipped.

That's not really much to work with, so we need to improve that.

As you can see in your invocation the environment created is called py36. What isn't really clear from the docs is that tox checks the name of the testenv against the platform and as there is nothing that fits it will simply not run any of the commands.

If you run tox against your ini like this you can see how it works:

$ tox -e macos,linux

linux installed: play==0.0.0
linux runtests: PYTHONHASHSEED='1353739769'
linux runtests: commands[0] | echo linux
WARNING:test command found but not installed in testenv
  cmd: /usr/bin/echo
  env: /home/ob/do/play/.tox/linux
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
linux
_______________________________________ summary _______________________________________
SKIPPED:  macos: platform mismatch
  linux: commands succeeded
  congratulations :)

As I am running on linux it uses that one and skips the macos env.

The example has an envlist set that assures this when running without a qualifier but it also obscures how this actually works, so definitely a documentation bug.

@obestwalter obestwalter added bug:minor does not affect many people or has no big impact area:documentation labels Jan 19, 2019
@obestwalter obestwalter changed the title Tox ignores per-platform commands Documentation how per-platform commands work needs improvement Jan 19, 2019
@obestwalter obestwalter self-assigned this Jan 19, 2019
@gaborbernat gaborbernat added the level:easy rought estimate that this might be quite easy to implement label Jan 25, 2019
@gaborbernat gaborbernat added the help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. label May 3, 2019
@FirePing32
Copy link

@keymone Can I work on this ?

@gaborbernat
Copy link
Member

Please go ahead.

@FirePing32
Copy link

FirePing32 commented Nov 27, 2020

@obestwalter @gaborbernat So just running tox will give the same invocation as given by @keymone without running any commands but running tox -e macOS, linux will run commands but gives an error along with it.

@FirePing32
Copy link

@obestwalter @gaborbernat Please see #1753

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:documentation bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. level:easy rought estimate that this might be quite easy to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants