Skip to content
Closed

test #112

Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion uv/src/uv/workspace/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ async def create(
raw_local = parse_local_packages(lock_data)
# Overlay each target package's SDK (deduped); fall back to the
# workspace root when no target is a local package.
codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."]
if all_packages:
codegen_paths = list(dict.fromkeys(raw_local.values())) or ["."]
else:
codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."]
for codegen_path in codegen_paths:
ws_dir = await _run_codegen(ws_dir, codegen_path)
if workspace_path == ".":
Expand Down
19 changes: 19 additions & 0 deletions uv/tests/test_workspace_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,3 +566,22 @@ def test_root_workspace_paths_unchanged(self):
for path in local.values():
resolved = posixpath.normpath(posixpath.join(".", path))
assert resolved == path


def test_codegen_paths_all_packages_visits_all_members():
raw_local = {
"app-one": "packages/app-one",
"app-two": "packages/app-two",
}
# all_packages=True derives paths for all local workspace members
codegen_paths = list(dict.fromkeys(raw_local.values())) or ["."]
assert codegen_paths == ["packages/app-one", "packages/app-two"]

# explicit selection visits only requested members
packages = ["app-one"]
codegen_paths = list(dict.fromkeys(raw_local[p] for p in packages if p in raw_local)) or ["."]
assert codegen_paths == ["packages/app-one"]

# bare root fallback when no members or selection
codegen_paths = list(dict.fromkeys(raw_local[p] for p in [] if p in raw_local)) or ["."]
assert codegen_paths == ["."]