Closed odaven closed 1 month ago
This seems to be a bug with neotest
itself. Following screencast
Screencast_2024-09-04-12-57-31.webm
Minimal init.lua
to reproduce without LazyVim
-- init.lua
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
-- local lazypath = vim.fn.expand("~/projects/plugins/lazy.nvim/")
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
vim.opt.ignorecase = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.g.mapleader = " "
-- install plugins
local plugins = {
{ "folke/tokyonight.nvim" },
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
opts = {
ensure_installed = {
"python",
"go",
"gomod",
"gowork",
"gosum",
},
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
{
"folke/which-key.nvim",
opts = {},
},
{
"nvim-neotest/neotest",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-python",
"fredrikaverpil/neotest-golang",
},
keys = {
{ "<leader>t", "", desc = "+test" },
{
"<leader>tt",
function()
require("neotest").run.run(vim.fn.expand("%"))
end,
desc = "Run File",
},
{
"<leader>tT",
function()
require("neotest").run.run(vim.uv.cwd())
end,
desc = "Run All Test Files",
},
{
"<leader>tr",
function()
require("neotest").run.run()
end,
desc = "Run Nearest",
},
{
"<leader>tl",
function()
require("neotest").run.run_last()
end,
desc = "Run Last",
},
{
"<leader>ts",
function()
require("neotest").summary.toggle()
end,
desc = "Toggle Summary",
},
{
"<leader>to",
function()
require("neotest").output.open({ enter = true, auto_close = true })
end,
desc = "Show Output",
},
{
"<leader>tO",
function()
require("neotest").output_panel.toggle()
end,
desc = "Toggle Output Panel",
},
{
"<leader>tS",
function()
require("neotest").run.stop()
end,
desc = "Stop",
},
{
"<leader>tw",
function()
require("neotest").watch.toggle(vim.fn.expand("%"))
end,
desc = "Toggle Watch",
},
},
config = function()
require("neotest").setup({
adapters = {
require("neotest-python")({}),
require("neotest-golang")({}),
},
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Put it in the folder with your Python files and run it with nvim -u init.lua test_whatever.py
.
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.1 Build type: Release LuaJIT 2.1.1724512491
Operating system/version
MacOs Ventura 13.6.9
Describe the bug
At the point of writing this bug the LazyVim version is 12.38.2
Using LazyVim in a python project with only enabling extras
extras.lang.python
andextras.test.core
.Starting tests with shortcuts as
<leader>tr
work as expected. The other variants likeRun File
andRun All Test Files
work also.After installing
extras.lang.go
those tests stop working and there is a popup showingNo test found
. The commandRun All Test Files
<leader>tT
shows the below message even though this is a Python project.The issue happens with a new LazyVim installation where the only extras enabled are:
In the other side, the Go project works without issues and test commands work as expected
Other languages I usually use that didn't show this issue are:
Steps To Reproduce
extras.lang.python
andextras.test.core
extras.lang.go
and restartextras.lang.go
and restartExpected Behavior
I expect that having python and go extras enabled at the same time and getting the tests working as expected in projects with those languages.
Repro