Fast pytest test tree for your apps folder in the Testing panel, with Run / Run with Coverage (pytest-cov), coverage.xml view, built-in coverage gutters and detection of new code that has no tests.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Testing-panel tree of every pytest test under your apps/ folder (folders -> files -> classes/functions -> methods).
Fast discovery: static scan, no Python spawned; tree appears instantly and updates live.
Run any node via python -m pytest <node ids>. Uses pytest-xdist (-n auto) for larger selections, --reuse-db with pytest-django, and --no-cov so a plain run is never slowed by addopts = --cov.
Run with Coverage uses pytest-cov (--cov --cov-branch), writes .vscode/coverage.xml, and shows it in Test Coverage.
Load coverage.xml just reads an existing file.
Install in your venv: pip install pytest pytest-django pytest-xdist pytest-cov
Coverage gutters (built in)
No Coverage Gutters extension needed. Open any Python file that is in coverage.xml and you get gutter marks and overview-ruler marks:
green = covered, yellow = some branches missed, red = not covered. The report reloads by itself whenever coverage.xml changes
(coverageXml.gutters.* settings, command Coverage XML: Toggle Gutters).
New code without tests
Detects code you just wrote that no test covers, even before any coverage run:
"New code" = lines changed vs git (coverageXml.diff.base, default HEAD = all uncommitted + untracked files; use origin/main for a whole branch).
Each new executable line is checked against coverage.xml:
not covered by any test (red): the report is up to date and the line was never executed.
no coverage data (orange): the file isn't in coverage.xml at all (no test touches it), or you wrote/edited the line after the last coverage run, so no test has run it yet.
partial (yellow): the line ran but not all branches did.
Shown as a marker plus an inline note on the line, Problems panel entries, and a status bar summary (New code: 62% covered, 7 lines untested, click for the list).
Updates live while you type (gutters shift with your edits) and on save. Comments, blank lines, docstrings and # pragma: no cover blocks are ignored; test files and migrations are excluded (coverageXml.diff.exclude).
Run tests with Run with Coverage; the marks turn green/red once the new report is written. Merged reports record a per-file covered-at time so a file edited after its last measurement is never trusted.
Commands: Show New Code Without Coverage, Re-check New Code, Go to Next/Previous Uncovered New Line.