Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytest-quickfix.nvim

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.

Usage

  1. Copy the pytest summary block to your clipboard.
  2. 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.

Install (lazy.nvim)

{
  "vector67/pytest-quickfix.nvim",
  cmd = "PytestQf",
  config = function()
    require("pytest_quickfix").setup({})
  end,
}

Configuration

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 :PytestQf from 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.

Notes

  • Only the summary block is parsed, not full tracebacks.
  • An entry whose file can't be found under the resolved root (e.g. with root = "cwd", or when pytest ran from a subpackage) points at line 1.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages