Skip to content

Setting to turn multi-project testing off #26136

Description

The support for Multi‐Project Testing in VS Code alongside Multi-root Workspaces is great, but I believe there's one short coming when used in combination of devcontainers.

Currently, there's no way to prevent the Python extension from discovering all Python projects in a workspace, (or I haven't found one). Discovery is possible on the host because the extension is smart enough to use each project's own virtual environment. In a setup where each project gets its own devcontainer, resolving only the dependencies of that specific project, the extension will still try to collect tests from other projects and will fail because no environment is available for them.

I've created a demo repository demonstrating this: https://github.com/superlevure/vscode-python-tests-discovery-issue.

Happy path (non devcontainer workflow):

  1. git clone git@github.com:superlevure/vscode-python-tests-discovery-issue.git
  2. cd vscode-python-tests-discovery-issue/folder_a
  3. uv sync
  4. cd ../folder_b
  5. uv sync
  6. cd ..
  7. code .
  8. "Open Workspace"
  9. Open src/folder_a/tests/test_foo.py and src/folder_b/tests/test_foo.py
  10. Refresh Tests (in the Python extension testing side bar)
  11. It works \o/
Image

Non happy path (devcontainer workflow):

  1. git clone git@github.com:superlevure/vscode-python-tests-discovery-issue.git
  2. cd vscode-python-tests-discovery-issue
  3. code .
  4. "Open Workspace"
  5. "Dev Containers: Rebuild and Reopen in Container"
  6. Select folder_a
  7. Open src/folder_a/tests/test_foo.py
  8. Refresh Tests (in the Python extension testing side bar)
  9. The extension tries to collect tests from folder_b, even though the current dev container has no environment for this project (it's specific to folder_a)
Image

Ideally, we should be able to prevent the extension from trying to collect tests from anywhere else than folder_a using a setting set specifically in .devcontainer/folder_a/devcontainer.json.

Thank you!

Metadata

Metadata

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions