You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repo layout: monorepo where each sub-package has its own pyproject.toml with [tool.pytest.ini_options] (different testpaths, addopts, pythonpath per package)
Problem
In a monorepo, pytest's rootdir resolution walks up from the file being discovered. When VS Code's test runner invokes pytest from the workspace root (not from each sub-package directory), pytest finds the root-level pyproject.toml (if any) or no config, and uses rootdir = <workspace root>. This means:
[tool.pytest.ini_options] in packages/api/pyproject.toml is ignored — its testpaths, pythonpath, and addopts don't apply.
packages/api/tests/ may not even be collected because testpaths in the root config doesn't include it.
Tests that pass in a terminal (cd packages/api && pytest) fail in VS Code's test runner with import errors because pythonpath = ["src"] (relative to packages/api) is not applied.
Expected
Provide a way to configure per-subfolder pytest invocation roots, such that VS Code runs pytest for packages/api/** with cwd=packages/api, picking up that package's pyproject.toml.
Activity