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

Labeled environments cannot use runners from provisioned plugins #2916

Closed
masenf opened this issue Feb 8, 2023 · 1 comment · Fixed by #2917
Closed

Labeled environments cannot use runners from provisioned plugins #2916

masenf opened this issue Feb 8, 2023 · 1 comment · Fixed by #2917
Assignees
Labels
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.

Comments

@masenf
Copy link
Collaborator

masenf commented Feb 8, 2023

Issue

When a tox environment has a runner derived from a plugin that is named in the requires key, the environment cannot appear in a top-level label expression.

See minimal reproducer: https://github.com/masenf/tox-label-provision-plugin-runner

[tox]
requires = foo-runner
labels =
    foo = bar, baz
envlist = bar, baz

[testenv:{bar,baz}]
runner = foo

running tox uses the envlist, which works fine.

running tox -m foo uses the label foo, and blows up before passing off control to the provisioned tox

Environment

Provide at least:

  • OS: ubuntu 20.04
  • pip list of the host Python where tox is installed:
cachetools==5.3.0
chardet==5.1.0
colorama==0.4.6
distlib==0.3.6
filelock==3.9.0
packaging==23.0
platformdirs==3.0.0
pluggy==1.0.0
pyproject-api==1.5.0
tomli==2.0.1
tox==4.4.4
virtualenv==20.19.0

Output of running tox

Provide the output of tox -rvv:

tox -rvv -m foo
ROOT: 1297 W will run in automatically provisioned tox, host /home/mfurer/.pytools/bin/python is missing [requires (has)]: foo-runner [tox/provision.py:125]
Traceback (most recent call last):
  File "/home/mfurer/.pytools/bin/tox", line 8, in <module>
    sys.exit(run())
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/run.py", line 41, in main
    result = provision(state)
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/provision.py", line 126, in provision
    return run_provision(provision_tox_env, state)
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/provision.py", line 144, in run_provision
    tox_env: PythonRun = cast(PythonRun, state.envs[name])
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/session/env_select.py", line 337, in __getitem__
    return self._defined_envs[item].env
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/session/env_select.py", line 233, in _defined_envs
    self._mark_active()
  File "/home/mfurer/.pytools/lib/python3.8/site-packages/tox/session/env_select.py", line 321, in _mark_active
    self._defined_envs_[env_name].is_active = True
KeyError: 'bar'

Minimal example

https://github.com/masenf/tox-label-provision-plugin-runner

@gaborbernat gaborbernat added 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. labels Feb 8, 2023
@masenf
Copy link
Collaborator Author

masenf commented Feb 8, 2023

Fix coming shortly

@masenf masenf self-assigned this Feb 8, 2023
masenf added a commit to masenf/tox that referenced this issue Feb 8, 2023
Do not attempt to set any test environments as active based on
user-supplied labels when tox will provision a new environment and
re-execute itself.

If any labeled environments depend on a future tox version or external
plugin, their configuration will be invalid and thus cannot be set
active.

fix tox-dev#2916
masenf added a commit to masenf/tox that referenced this issue Feb 8, 2023
Do not attempt to set any test environments as active based on
user-supplied labels when tox will provision a new environment and
re-execute itself.

If any labeled environments depend on a future tox version or external
plugin, their configuration will be invalid and thus cannot be set
active.

fix tox-dev#2916
gaborbernat pushed a commit that referenced this issue Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants