Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nvim-neotest/neotest-python
https://github.com/nvim-neotest/neotest-python
lua neovim pytest python unittest
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nvim-neotest/neotest-python
- Owner: nvim-neotest
- License: mit
- Created: 2022-01-02T23:13:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T21:02:31.000Z (8 months ago)
- Last Synced: 2024-06-09T22:43:10.628Z (5 months ago)
- Topics: lua, neovim, pytest, python, unittest
- Language: Python
- Size: 69.3 KB
- Stars: 110
- Watchers: 4
- Forks: 33
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# neotest-python
[Neotest](https://github.com/rcarriga/neotest) adapter for python.
Supports Pytest and unittest test files.Requires [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and the parser for python.
```lua
require("neotest").setup({
adapters = {
require("neotest-python")
}
})
```You can optionally supply configuration settings:
```lua
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,
})
}
})```