Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Possible adapter race condition causing fail to run all tests #466

Open
brablc opened this issue Nov 1, 2024 · 0 comments
Open

[BUG] Possible adapter race condition causing fail to run all tests #466

brablc opened this issue Nov 1, 2024 · 0 comments
Assignees

Comments

@brablc
Copy link

brablc commented Nov 1, 2024

NeoVim Version

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068

Describe the bug
When running require("neotest").run.run(vim.uv.cwd()) in Python project, neotest-golang adapter reports missing go tests:

Caution

The selected directory does not contain a go.mod file or is not part of a Go module.

To Reproduce

vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))

local lazypath = "/tmp/lazy/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",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end

vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		"nvim-neotest/neotest",
		dependencies = {
			"nvim-neotest/nvim-nio",
			"nvim-lua/plenary.nvim",
			"nvim-treesitter/nvim-treesitter",
			"nvim-neotest/neotest-python",
			"fredrikaverpil/neotest-golang",
		},
		config = function()
			require("neotest").setup({
				adapters = {
					require("neotest-golang")({}),
					require("neotest-python")({
						runner = "pytest",
						python = ".venv/bin/python",
						dap = { justMyCode = false },
					}),
				},
			})
		end,
	},
})

Steps to reproduce the behavior:

  1. Have python projects with some pytests.
  2. Open nvim in the project dir
  3. Execute: lua require("neotest").run.run(vim.uv.cwd())
  4. SOMETIMES see error: The selected directory does not contain a go.mod file or is not part of a Go module.

Expected behavior
All Python tests get always executed. Now it looks like neotest-golang adapter sometimes gets loaded first and does not find any Go tests.

Logs

Output

INFO | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:48 | Emitting started event
DEBUG | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event started
DEBUG | 2024-11-01T14:36:17Z+0100 | ...hare/nvim/lazy/neotest/lua/neotest/client/state/init.lua:85 | Setting positions to running /home/ondrej/Projects/myproject
INFO | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:48 | Emitting run event
DEBUG | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener state for event run
DEBUG | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener diagnostic for event run
DEBUG | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener status for event run
DEBUG | 2024-11-01T14:36:17Z+0100 | ...are/nvim/lazy/neotest/lua/neotest/client/events/init.lua:50 | Calling listener summary for event run
DEBUG | 2024-11-01T14:36:17Z+0100 | .../nvim/lazy/neotest-golang/lua/neotest-golang/logging.lua:47 | [neotest-golang] Searching for go.mod in /home/ondrej/Projects/myproject
DEBUG | 2024-11-01T14:36:17Z+0100 | .../nvim/lazy/neotest-golang/lua/neotest-golang/logging.lua:47 | [neotest-golang] Searching for go.mod in /home/ondrej/Projects
ERROR | 2024-11-01T14:36:17Z+0100 | .../nvim/lazy/neotest-golang/lua/neotest-golang/logging.lua:79 | [neotest-golang] The selected directory does not contain a go.mod file or is not part of a Go module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants