local M = {} if pcode.pytest then M = { "nvim-neotest/neotest", dependencies = { "mfussenegger/nvim-dap-python", "antoinemadec/FixCursorHold.nvim", "nvim-neotest/nvim-nio", "nvim-neotest/neotest-python", }, config = function() local mason_path = vim.fn.glob(vim.fn.stdpath("data") .. "/mason/") pcall(function() require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python") end) require("neotest").setup({ adapters = { require("neotest-python")({ dap = { justMyCode = false }, args = { "--log-level", "DEBUG" }, runner = "pytest", python = "python", }), }, }) end, -- stylua: ignore keys = { { "T","",desc="  Test"}, { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, }, } end return M