diff options
| author | Ibrahim Muftee <ibrahim@muftee.net> | 2025-06-23 20:44:28 -0500 |
|---|---|---|
| committer | Ibrahim Muftee <ibrahim@muftee.net> | 2026-07-01 00:23:31 -0400 |
| commit | 85e2428a021c541638d2c44364987f51b5c908aa (patch) | |
| tree | af95fade0f15bac30b8333c6606f5ff7c7681544 /dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua | |
| parent | cd96aedafa3be65084efb276f05aa089261fbb64 (diff) | |
feat(nvim) begin new config
Diffstat (limited to 'dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua')
| -rw-r--r-- | dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua b/dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua new file mode 100644 index 0000000..68e7bc3 --- /dev/null +++ b/dot_config/nvim.new/lua/ibrahim/plugins/neotest.lua @@ -0,0 +1,44 @@ +return { + "nvim-neotest/neotest", + ft = { "python" }, + dependencies = { + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-neotest/neotest-python", + "nvim-neotest/nvim-nio", + }, + opts = function() + return { + adapters = { + require("neotest-python")({ + -- Use the current Python binary on the path. + -- This will usually be a virtual environment. + python = "python", + runner = "pytest", + is_test_file = function(file_path) ---@param file_path string + -- I place all of my Python test files in a + -- `tests` directory, and they all start with + -- `test_` per Pytest conventions. + local normalized_path = vim.fs.normalize(file_path) + return normalized_path:match("tests/.*%/test_.*%.py$") ~= nil + end, + }), + }, + } + end, + config = function(_, opts) + require("neotest").setup(opts) + + vim.keymap.set({ "n" }, "<leader>tr", require("neotest").run.run, { desc = "Neotest: run test at cursor" }) + vim.keymap.set({ "n" }, "<leader>tf", function() + require("neotest").run.run(vim.fn.expand("%")) + end, { desc = "Neotest: run all tests in current file" }) + vim.keymap.set( + { "n" }, + "<leader>ts", + require("neotest").summary.toggle, + { desc = "Neotest: toggle summary panel" } + ) + end, +} |
