Skip to content

馃悰 fix(tox_env): canonicalize names when resolving dependency-group extras - #4061

Open
MohammedAlkindi wants to merge 3 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/dependency-group-extra-canonicalization
Open

馃悰 fix(tox_env): canonicalize names when resolving dependency-group extras#4061
MohammedAlkindi wants to merge 3 commits into
tox-dev:mainfrom
MohammedAlkindi:fix/dependency-group-extra-canonicalization

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

A dependency-groups self-reference fails when the project name or the extra is spelled non-canonically. _add_extra_to_deps already canonicalizes the extra it looks up, but resolve() passes project.optional-dependencies with its raw keys, so extra_1 never matches the canonical extra-1. Separately unwrap_nested_extras compares dependency.name == project_name directly, so demo_pkg[...] does not match a project named demo-pkg.

Both spellings are legal: PEP 503 says these compare equal after normalization, and _resolve_dependency_group a few lines above already canonicalizes group names.

On main, with name = "demo-pkg" and test = ["demo_pkg[extra1]"]:

resolve(root, {"test"})  ->  ['demo_pkg[extra1]']

The self-reference is never unwrapped and reaches pip as an unresolvable requirement. The other spelling, demo-pkg[extra_1], raises Fail: extra not found.

Two tests added, one per spelling, both failing before. Reverting either half of the fix on its own makes exactly its own test fail again, so neither is redundant.

tests/tox_env/ is unchanged at 230 pre-existing failures either side with an identical failure set by name; the only delta is these two going green.

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