f48dbfa52b chore: Replace use of deprecated vim.tbl_flatten (#112)
vim.tbl_flatten is deprecated and will be removed in 0.13. Just replaced
it with the recommendation in the deprecation notice.

For some reason discovering tests did not work anymore after upgrading from
0.11.x to 0.12.1 even though vim.tbl_flatten still works in this
version. Replacing it fixes test discovery for me though and it needs to
be done before 0.13 anyway.

Co-authored-by: Sam Castelain <sam@secury-360.com>
2026-08-18 16:40:31 +03:00
2022-01-02 23:15:23 +00:00
2022-01-02 23:15:23 +00:00
2022-07-25 21:23:34 +01:00
2026-08-18 16:39:57 +03:00
2022-01-02 23:15:23 +00:00

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,
        -- !!EXPERIMENTAL!! Enable shelling out to `pytest` to discover test
        -- instances for files containing a parametrize mark (default: false)
        pytest_discover_instances = true,
    })
  }
})

S
Description
No description provided
Readme
199 KiB
Languages
Python 62%
Lua 36.5%
Shell 1.5%