Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/utils/test_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@
([_PACKAGE_FOO], {}, [], set()),
# An empty extras group should return an empty list
([_PACKAGE_FOO], {"group0": []}, ["group0"], set()),
# Unknown extras are ignored, including alongside a known extra
([_PACKAGE_FOO], {"group0": ["foo"]}, ["unknown"], set()),
(
[_PACKAGE_FOO, _PACKAGE_BAR],
{"group0": ["bar"]},
["unknown", "group0"],
{"bar", "foo"},
),
# Missing packages do not prevent resolving the available packages
(
[_PACKAGE_SPAM],
{"group0": ["foo", "spam"]},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Missing-package test misses later results

When a future change stops traversal when it encounters a missing package, stack.pop() visits spam before the missing foo, so this assertion still passes if resolution returns immediately on a missing package; it does not verify that available packages queued after a miss are resolved.

Reverse the requested package order in this case, or add a case where an available package is popped after a missing one.

Prompt for AI agents
In `tests/utils/test_extras.py` at line 48:

**Missing-package test misses later results**

When a future change stops traversal when it encounters a missing package, `stack.pop()` visits `spam` before the missing `foo`, so this assertion still passes if resolution returns immediately on a missing package; it does not verify that available packages queued after a miss are resolved.

Reverse the requested package order in this case, or add a case where an available package is popped after a missing one.

["group0"],
{"spam"},
),
# A missing transitive dependency does not discard its parent
(
[_PACKAGE_BAR, _PACKAGE_SPAM],
{"group0": ["bar", "spam"]},
["group0"],
{"bar", "spam"},
),
# Selecting an extras group should return the contained packages
(
[_PACKAGE_FOO, _PACKAGE_SPAM, _PACKAGE_BAR],
Expand Down
Loading