feat: remove file searching

This commit is contained in:
Rónán Carrigan
2022-01-07 23:06:55 +00:00
parent c0a5d07143
commit 5bca040611

View File

@@ -32,7 +32,7 @@ local get_runner = function()
end end
---@type NeotestAdapter ---@type NeotestAdapter
local PythonNeotestAdapter = {name = "neotest-python"} local PythonNeotestAdapter = { name = "neotest-python" }
function PythonNeotestAdapter.is_test_file(file_path) function PythonNeotestAdapter.is_test_file(file_path)
return base.is_test_file(file_path) return base.is_test_file(file_path)
@@ -41,7 +41,6 @@ end
---@async ---@async
---@return Tree | nil ---@return Tree | nil
function PythonNeotestAdapter.discover_positions(path) function PythonNeotestAdapter.discover_positions(path)
if path and not lib.files.is_dir(path) then
local query = [[ local query = [[
((function_definition ((function_definition
name: (identifier) @test.name) name: (identifier) @test.name)
@@ -55,9 +54,6 @@ function PythonNeotestAdapter.discover_positions(path)
return lib.treesitter.parse_positions(path, query, { return lib.treesitter.parse_positions(path, query, {
require_namespaces = get_runner() == "unittest", require_namespaces = get_runner() == "unittest",
}) })
end
local files = lib.func_util.filter_list(base.is_test_file, lib.files.find({ path }))
return lib.files.parse_dir_from_files(path, files)
end end
---@param args NeotestRunArgs ---@param args NeotestRunArgs