| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
## Summary This PR implements **project-based test discovery** for pytest, enabling multi-project workspace support. When the Python Environments API is available, the extension now discovers Python projects within workspaces and creates separate test tree roots for each project with its own Python environment. ## What's New ### Project-Based Testing Architecture - **TestProjectRegistry**: Manages the lifecycle of Python test projects, including: - Discovering projects via Python Environments API - Creating ProjectAdapter instances per workspace - Computing nested project relationships for ignore lists - Fallback to "legacy" single-adapter mode when API unavailable - **ProjectAdapter**: Interface representing a single Python project with test infrastructure: - Project identity (ID, name, URI) - Python environment from the environments API - Test framework adapters (discovery/execution) - Nested project ignore paths ### Key Features - ✅ **Multi-project workspaces**: Each Python project gets its own test tree root - ✅ **Nested project handling**: Parent projects automatically ignore nested child projects via `--ignore` flags - ✅ **Graceful fallback**: Falls back to legacy single-adapter mode if Python Environments API is unavailable - ✅ **Project root path**: Python-side `get_test_root_path()` function returns appropriate root for test tree ### Code Improvements - Standardized logging prefixes to `[test-by-project]` across all files - Centralized adapter creation via `createTestAdapters()` helper method - Extracted reusable methods for discovery, execution, and file watching ## Scope & Limitations > **⚠️ Important: unittest is NOT supported in this PR** > > This PR focuses exclusively on **pytest**. unittest support for project-based testing will be implemented in a future PR. ## Testing - Added unit tests for `TestProjectRegistry` class - Added unit tests for Python-side `get_test_root_path()` function - Manual testing with multi-project workspaces ## Related Issues first step in: microsoft/vscode-python-environments#987 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This adds a place within the github workspace that developers can store any AI related artifacts they create that could be useful but they don't want to commit. Things like issue summarization, plans for features, code analysis etc
There was a problem hiding this comment.
This PR adds project-based (multi-project) testing support to the VS Code Python extension’s Test Explorer integration, leveraging the Python Environments API so each project can be discovered/run/debugged with its own environment (fixes microsoft/vscode-python-environments#987).
Changes:
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file| File | Description |
|---|---|
| src/client/testing/testController/controller.ts | Adds project-based activation/discovery/execution flow and project-change handling. |
| src/client/testing/testController/common/testProjectRegistry.ts | New registry for discovering projects, creating project-specific adapters/resolvers, and nested ignore computation. |
| src/client/testing/testController/common/projectAdapter.ts | Defines per-project adapter shape (env + adapters + resolver + lifecycle). |
| src/client/testing/testController/common/projectUtils.ts | Adds project ID scoping utilities + shared adapter creation helper. |
| src/client/testing/testController/common/projectTestExecution.ts | Executes selected tests grouped by owning project with project-specific environment/debug/coverage behavior. |
| src/client/testing/testController/common/utils.ts | Adds project-scoped IDs in populateTestTree() and project-aware error labels. |
| src/client/testing/testController/common/testDiscoveryHandler.ts | Routes discovery into project-scoped IDs and project-scoped error nodes. |
| src/client/testing/testController/pytest/pytestDiscoveryAdapter.ts | Threads ProjectAdapter through discovery; adds nested --ignore support; sets PROJECT_ROOT_PATH. |
| src/client/testing/testController/pytest/pytestExecutionAdapter.ts | Threads ProjectAdapter through execution; uses project env when available; sets PROJECT_ROOT_PATH. |
| src/client/testing/testController/unittest/testDiscoveryAdapter.ts | Threads ProjectAdapter through discovery; uses project env when available; sets PROJECT_ROOT_PATH. |
| src/client/testing/testController/unittest/testExecutionAdapter.ts | Threads ProjectAdapter through execution/debug; uses project env when available; sets PROJECT_ROOT_PATH. |
| src/client/testing/testController/workspaceTestAdapter.ts | Allows passing a ProjectAdapter to execution for project-scoped runs. |
| src/client/testing/common/debugLauncher.ts | Adds multi-session tracking via markers; supports project-based debug naming + Python path resolution. |
| python_files/vscode_pytest/init.py | Uses PROJECT_ROOT_PATH to root discovery/execution payload cwd/test-tree root for project mode. |
| python_files/unittestadapter/discovery.py | Supports PROJECT_ROOT_PATH to override cwd/top-level behavior for project-rooted discovery. |
| python_files/unittestadapter/execution.py | Supports PROJECT_ROOT_PATH to override cwd in execution payloads. |
| src/test/vscode-mock.ts | Adds vscode.tests.createTestController() mock for unit tests. |
| src/test/testing/testController/** | Adds unit tests for project registry, project execution grouping, controller behavior, adapters, and utilities. |
| python_files/tests/** | Adds Python-side tests for PROJECT_ROOT_PATH behavior for both unittest + pytest. |
| .github/instructions/testing_feature_area.instructions.md | Documents the new project-based testing architecture and key files/tests. |
Sorry, something went wrong.
fixes microsoft/vscode-python-environments#987 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
fixes microsoft/vscode-python-environments#987