Skip to content
Open
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
4 changes: 3 additions & 1 deletion python/scripts/task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def discover_projects(workspace_pyproject_file: Path) -> list[Path]:
for project in projects:
if "*" in project:
globbed = glob.glob(str(project), root_dir=workspace_pyproject_file.parent)
globbed_paths = [Path(p) for p in globbed]
globbed_paths = [
Path(path) for path in globbed if (workspace_pyproject_file.parent / path / "pyproject.toml").is_file()
]
all_projects.extend(globbed_paths)
else:
all_projects.append(Path(project))
Expand Down
17 changes: 17 additions & 0 deletions python/scripts/tests/test_task_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Microsoft. All rights reserved.

from pathlib import Path

from scripts.task_runner import discover_projects


def test_discover_projects_ignores_glob_matches_without_pyproject(tmp_path: Path) -> None:
workspace_pyproject = tmp_path / "pyproject.toml"
workspace_pyproject.write_text('[tool.uv.workspace]\nmembers = ["packages/*"]\n')
Comment thread
luisangelrod marked this conversation as resolved.

valid_project = tmp_path / "packages" / "valid"
valid_project.mkdir(parents=True)
(valid_project / "pyproject.toml").write_text('[project]\nname = "valid"\nversion = "1.0.0"\n')
(tmp_path / "packages" / "stale").mkdir()

assert discover_projects(workspace_pyproject) == [Path("packages/valid")]
4 changes: 4 additions & 0 deletions python/scripts/workspace_poe_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ def run_aggregate_test(project_pattern: str, cov: bool, extra_args: list[str]) -
return

test_dirs = [relative_path(path) for path in collect_test_dirs(projects)]
if project_pattern == "*":
script_test_dir = WORKSPACE_ROOT / "scripts" / "tests"
if script_test_dir.is_dir():
test_dirs.append(relative_path(script_test_dir))
if not test_dirs:
print("[yellow]No test directories found for the selected projects, skipping pytest.[/yellow]")
return
Expand Down
Loading