Closed wookayin closed 1 year ago
This is a dap configuration issue. Use the following, when setting up neotest-python, to print to the console
require("neotest-python")({
dap = { console = "integratedTerminal" },
})
Thanks, that works perfectly. Would you want to update README/documentation for neotest-python (or other adapters if applicable)?
Thanks but adding dap arguments is already documented for neotest-python and the same settings won't apply to different adapters
I see. I did not see anything about dap.console
or integratedTerminal
-- the readme at https://github.com/nvim-neotest/neotest-python#neotest-python says {dap = {justMyCode = false}}
only. It would be not that clear what the schema actually looks like and what options are allowed or how they would be passed to DAP, which I just figured out ---- the dap
opts would have the same schema as :h dap-configuration
(whose docs even does not clearly mention available options) and dap-python
specific configs.
Per nvim-dap-python
doc: https://github.com/mfussenegger/nvim-dap-python/blob/master/doc/dap-python.txt#L72-L116
I've added a link to the debugpy wiki to make it more clear :+1:
NeoVim Version
NVIM v0.9.0-dev-2756-geb123b565 neotest: 7e73ba5
Describe the bug
When running neotest via DAP (Debugger Adapter Protocol), the output prints at the REPL widget rather than console.
Please see the below section for reproduce steps.
Expected behavior
The output should appear in the "console" widget.
If we run the test method using
dap-python
, we can see the output is printed at the "console" :To Reproduce
minimal.lua
```lua -- ignore default config and plugins vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim")) vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site")) vim.opt.termguicolors = true -- append test directory local test_dir = "/tmp/nvim-config" vim.opt.runtimepath:append(vim.fn.expand(test_dir)) vim.opt.packpath:append(vim.fn.expand(test_dir)) -- install packer local install_path = test_dir .. "/pack/packer/start/packer.nvim" local install_plugins = false if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) vim.cmd("packadd packer.nvim") install_plugins = true end local packer = require("packer") packer.init({ package_root = test_dir .. "/pack", compile_path = test_dir .. "/plugin/packer_compiled.lua", }) packer.startup(function(use) use("wbthomason/packer.nvim") -- Neotest use({ "nvim-neotest/neotest-python", requires = { "nvim-neotest/neotest", "vim-test/vim-test", "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", "antoinemadec/FixCursorHold.nvim", }, config = function() require("neotest").setup({ adapters = { require("neotest-python")({ dap = { justMyCode = false }, args = { "-vv", "-s" }, runner = 'pytest', }), }, }) end, }) -- DAP use({ 'rcarriga/nvim-dap-ui', requires = {'mfussenegger/nvim-dap'}, config = function() local dap = require "dap" local dapui = require "dapui" dapui.setup { } dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open {} end end, }) use({ 'mfussenegger/nvim-dap-python', requires = {'mfussenegger/nvim-dap'}, config = function() local dap_python = require 'dap-python' dap_python.setup() dap_python.test_runner = 'pytest' end, }) if install_plugins then packer.sync() end end) ```foo_test.py
:lua require'neotest'.run.run({strategy = 'dap'})
Logs I see no relevant log entries.
Additional context N/A