nvim-neotest / nvim-neotest/neotest-python

dap strategy: empty console and noise in the repl

Open
#50 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
192
Forks
60
PR merge metrics
No merged PRs in 30d

Description

Hi.
I am not really which neovim plugin is responsible for this behavior, but I can move this issue elsewhere if this does not fall on the side of neotest-python.

Why a pretty default configuration, running a test with lua require("neotest").run.run({strategy = "dap"}) displays:

  • nothing in the console
  • the pytest initialization output in the repl

Capture d’écran du 2023-07-17 17-59-06

I am not sure this is wanted. Naively I would have expected all the output in the console.

my configuration
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
    -- Packer can manage itself
    use 'wbthomason/packer.nvim'

    -- syntax highlighting
    use {
        'nvim-treesitter/nvim-treesitter',
        run = function()
            local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
            ts_update()
        end,
    }

    -- display the current functions/loops etc
    use "nvim-treesitter/nvim-treesitter-context"

    -- basic configuration to use LSP
    use {
        'VonHeikemen/lsp-zero.nvim',
        branch = 'v2.x',
        requires = {
            -- LSP Support
            {'neovim/nvim-lspconfig'},
            {
              'williamboman/mason.nvim',
              build = function()
                pcall(vim.cmd, 'MasonUpdate')
              end,
            },
            {'williamboman/mason-lspconfig.nvim'},

            -- Autocompletion
            {'hrsh7th/nvim-cmp'},
            {'hrsh7th/cmp-buffer'},
            {'hrsh7th/cmp-path'},
            {'saadparwaiz1/cmp_luasnip'},
            {'hrsh7th/cmp-nvim-lsp'},
            {'hrsh7th/cmp-nvim-lua'},

            -- Snippets
            {'L3MON4D3/LuaSnip'},
            {'rafamadriz/friendly-snippets'},
        }
    }

    -- unit tests with vim
    use {
        "nvim-neotest/neotest",
        requires = {
            "nvim-lua/plenary.nvim",
            "nvim-treesitter/nvim-treesitter",
            "antoinemadec/FixCursorHold.nvim",
            "nvim-neotest/neotest-python",
        }
    }

    -- debugger protocol
    use 'mfussenegger/nvim-dap'
    use 'mfussenegger/nvim-dap-python'
    use 'theHamsta/nvim-dap-virtual-text' -- in file variable inspection text
    use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } -- complete debug UI
    use 'LiadOz/nvim-dap-repl-highlights' -- syntax highlighting in the dap REPL
    use 'rcarriga/cmp-dap' -- autocompletion in the dap REPL

    -- checking, doc, and completions
    use 'folke/neodev.nvim'

end)

local dap = require('dap')
require("neotest").setup({
    adapters = {
        require("neotest-python")({
            dap = {
                django = true,
                jinja = true,
                justMyCode = false,
                redirectOutput = true,
                showReturnValue = true,
            },
        }),
    }
})
require('dap-python').setup()

Any idea if this is a configuration issue, a bug in neotest or neotest python, something in the nvim-dap or nvim-dap-python side or even in debugpy?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with lua require("neotest").run.run({strategy = "dap"}) using the configuration shown, including neotest-python, nvim-dap, nvim-dap-python, nvim-dap-ui, and debugpy. Trace whether the empty console and pytest initialization output belong to neotest-python or another listed DAP component; done means identifying the responsible component and establishing the intended output location.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim, python
Domain
devtools, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.