Skip to content

Commit

Permalink
fix: no tests found bug in python files
Browse files Browse the repository at this point in the history
  • Loading branch information
olisikh committed Jan 3, 2025
1 parent a2861ab commit ff316aa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lua/neotest-python/adapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,22 @@ return function(config)
return script_args
end

local function get_root(path)
return base.get_root(path) or vim.loop.cwd() or ""
end

local function filter_dir(name)
return name ~= "venv"
end

---@type neotest.Adapter
return {
name = "neotest-python",
root = base.get_root,
filter_dir = function(name)
return name ~= "venv"
end,
root = get_root,
filter_dir = filter_dir,
is_test_file = config.is_test_file,
discover_positions = function(path)
local root = base.get_root(path) or vim.loop.cwd() or ""
local root = get_root(path)

local python_command = config.get_python_command(root)
local runner = config.get_runner(python_command)
Expand All @@ -79,8 +85,7 @@ return function(config)
build_spec = function(args)
local position = args.tree:data()

local root = base.get_root(position.path) or vim.loop.cwd() or ""

local root = get_root(position.path)
local python_command = config.get_python_command(root)
local runner = config.get_runner(python_command)

Expand Down

0 comments on commit ff316aa

Please sign in to comment.