Skip to content

Commit

Permalink
Set up dap-python to run tests without coverage (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
jisantuc authored Mar 28, 2024
1 parent c8a43eb commit 67f3d20
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dotfiles/neovim/ftplugin/python.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
-- add special way to run black, since pyright doesn't have a code format option
vim.api.nvim_set_keymap("n", "<leader>f", "<cmd>!black %<CR>", { noremap = true, desc = "Run black on buffer" })

require("dap-python").setup("python")
local dap_python = require("dap-python")

require("dap-python").test_runner = "pytest"
dap_python.setup("python")
dap_python.test_runner = "pytest_no_cov"
function dap_python.test_runners.pytest_no_cov(classname, methodname)
local test_module, test_args = dap_python.test_runners.pytest(classname, methodname)
test_args[#test_args + 1] = "--no-cov"
return test_module, test_args
end

vim.api.nvim_set_keymap("n",
"<leader>cdb",
Expand Down

0 comments on commit 67f3d20

Please sign in to comment.