Skip to content

Register the factor label for a bare labeled dict in env_list - #4062

Open
dylanpulver wants to merge 1 commit into
tox-dev:mainfrom
dylanpulver:fix-env-list-bare-labeled-factor
Open

Register the factor label for a bare labeled dict in env_list#4062
dylanpulver wants to merge 1 commit into
tox-dev:mainfrom
dylanpulver:fix-env-list-bare-labeled-factor

Conversation

@dylanpulver

Copy link
Copy Markdown
Contributor

docs/reference/config.rst:130 says an env_list item may be "a labeled dict ({ ecosystem = ["oci", "python"] }) that also registers a {factor:label} name". It does not.

env_list = [{ ecosystem = ["oci", "python"] }]
[env_run_base]
description = "Sync {factor:ecosystem} artifacts"

tox c -e oci -k descriptionSync artifacts. The identical group inside a product dict → Sync oci artifacts.

Cause

_extract_env_list_labels only walks items with a "product" key — correct for #3865, added when product was the only dict shape env_list took. #3923 then taught TomlLoader.to_env_list three shapes and updated these docs, but never touched the source one directory over. The sibling path for [env_base.*].factors already registers bare groups.

Fix

Register the label for a bare labeled dict too, honouring default as the product branch does. extract_label returns None for a range dict, so bare ranges are unaffected.

Verification

Reverting the source fails both new tests; a naive variant that registers the label but drops default fails the second. tests/config: 6687 passed, 2 skipped. ty, mypy, pyrefly and pre-commit clean.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation (the docs already describe this)

The configuration reference states that a bare labeled dict in env_list
'also registers a {factor:label} name', but _extract_env_list_labels only
walked items carrying a 'product' key, so {factor:ecosystem} resolved to
an empty string for the bare form while the product-wrapped form resolved
it correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant