Turn a pasted pytest summary block into a Neovim quickfix list, with each entry pointing at the line where the failing test is defined.
pytest's summary lines look like:
FAILED tests/foo/test_bar.py::test_it_works[case] - AssertionError: ...
ERROR tests/foo/test_bar.py::TestThings::test_method - RuntimeError: ...
They carry a file and a test node id but no line number. This plugin parses
them, finds the def <test> line in each file, dedups FAILED/ERROR pairs
for the same test, and populates the quickfix list.
- Copy the pytest summary block to your clipboard.
- In Neovim (with its working directory at the repo root pytest ran from),
run
:PytestQf.
The quickfix list opens with one entry per failing test.
{
"vector67/pytest-quickfix.nvim",
cmd = "PytestQf",
config = function()
require("pytest_quickfix").setup({})
end,
}Defaults:
require("pytest_quickfix").setup({
register = "+", -- register/clipboard to read the paste from
root = "git", -- base dir for relative paths (see below)
open = true, -- run :copen after building the list
})root controls how relative pytest paths are resolved. It accepts:
"git"(default) — the nearest ancestor of the current directory containing.git, falling back to the working directory when there is no git repo. This means you can run:PytestQffrom any subdirectory of the project."cwd"— Neovim's current working directory.- a function — called with no arguments, returns the base directory.
- a literal path string — used as-is.
- Only the summary block is parsed, not full tracebacks.
- An entry whose file can't be found under the resolved
root(e.g. withroot = "cwd", or when pytest ran from a subpackage) points at line 1.