some fixes to Python debugging
This commit is contained in:
@@ -5,8 +5,9 @@ return {
|
|||||||
dependencies = "mfussenegger/nvim-dap",
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
local dap_python = require("dap-python")
|
||||||
|
|
||||||
require("dap-python").setup()
|
dap_python.setup()
|
||||||
|
|
||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
{
|
{
|
||||||
@@ -39,6 +40,16 @@ return {
|
|||||||
console = "integratedTerminal",
|
console = "integratedTerminal",
|
||||||
env = { PYTHONPATH = "${workspaceFolder}" },
|
env = { PYTHONPATH = "${workspaceFolder}" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type = "python",
|
||||||
|
request = "launch",
|
||||||
|
name = "Debug pytest file",
|
||||||
|
module = "pytest",
|
||||||
|
args = { "${file}", "-v", "-s" },
|
||||||
|
cwd = "${workspaceFolder}",
|
||||||
|
env = { PYTHONPATH = "${workspaceFolder}" },
|
||||||
|
console = "integratedTerminal",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type = "python",
|
type = "python",
|
||||||
request = "launch",
|
request = "launch",
|
||||||
@@ -56,6 +67,9 @@ return {
|
|||||||
args = { "discover", "-s", "test", "-v" },
|
args = { "discover", "-s", "test", "-v" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>dtm", dap_python.test_method, { desc = "Debug test method" })
|
||||||
|
vim.keymap.set("n", "<leader>dtc", dap_python.test_class, { desc = "Debug test class" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user