458f35723f394cfe90d3a3f360226da274f0390b
Given a test like: ```py @pytest.mark.parametrize("a,b", [("b", "c"), ("c", "d")]) def test_a(a, b): assert False ``` This modifies the diagnostic message from: ``` neotest: assert False neotest: assert False ``` to: ``` neotest: [b-c] assert False neotest: [c-d] assert False ``` This is the same internal value which `pytest` uses for parametrized instances in its output, so it should be fully consistent. Without this, the diagnostic messages aren't very useful for parametrized tests: you can't identify _which_ of the multiple test which execute the given line are failing. Fixes: #30
neotest-python
Neotest adapter for python. Supports Pytest and unittest test files.
Requires nvim-treesitter and the parser for python.
require("neotest").setup({
adapters = {
require("neotest-python")
}
})
You can optionally supply configuration settings:
require("neotest").setup({
adapters = {
require("neotest-python")({
-- Extra arguments for nvim-dap configuration
-- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values
dap = { justMyCode = false },
-- Command line arguments for runner
-- Can also be a function to return dynamic values
args = {"--log-level", "DEBUG"},
-- Runner to use. Will use pytest if available by default.
-- Can be a function to return dynamic value.
runner = "pytest",
-- Custom python path for the runner.
-- Can be a string or a list of strings.
-- Can also be a function to return dynamic value.
-- If not provided, the path will be inferred by checking for
-- virtual envs in the local directory and for Pipenev/Poetry configs
python = ".venv/bin/python"
-- Returns if a given file path is a test file.
-- NB: This function is called a lot so don't perform any heavy tasks within it.
is_test_file = function(file_path)
...
end,
})
}
})
Description
Languages
Python
60.7%
Lua
37.7%
Shell
1.6%