Pytest for Neovim

https://news.ycombinator.com/rss Hits: 12
Summary

About the project Testing integrated in neovim with pytest. Include Docker support. This project is in progress, I will be adding more features in the future and I open to contributions. Getting Started These instructions will help you set up and use pytest.nvim in your Neovim environment. Prerequisites Neovim 0.5.0 or later pytest in your environment (pip install pytest) Installation Install the pytest.nvim plugin using your preferred plugin manager: Lazyvim: { " richardhapb/pytest.nvim " , opts = {} } Packer: use { " richardhapb/pytest.nvim " , opt = true } Vim-Plug: Plug ' richardhapb/pytest.nvim ' Usage Load the pytest plugin in your Neovim configuration if you haven't already done so. For example: require ( ' pytest ' ). setup () Use the :Pytest command to run the tests in the current buffer. To check the entire buffer: :Pytest To check the output of the tests: :PytestOutput You can attach the test to the current buffer, this runs test on save: :PytestAttach You can detach the test from the current buffer: :PytestDetach Docker enable on the way :PytestEnableDocker Docker disabled on the way :PytestDisableDocker The default keybinding that runs :Pytest is <leader>T . Defaults The plugin provides the following default keymap: <leader>TT - Run pytest for the current file (normal mode) - Run pytest for the current file (normal mode) <leader>Ta - Attach pytest to the current buffer (normal mode) - Attach pytest to the current buffer (normal mode) <leader>Td - Detach pytest from the current buffer (normal mode) Default settings, is not necessary to set up, but you can change the settings in your configuration file. require ' pytest ' . setup { docker = { enabled = true , -- Enable docker support container = ' app-1 ' , -- Container where the tests will be run docker_path = ' /usr/src/app ' , -- This is the default path, if you use docker compose this is obtained from the docker compose file docker_path_prefix = ' app ' , -- This is the prefix for the path in the cwd ...

First seen: 2025-04-05 09:06

Last seen: 2025-04-05 20:10