feat(pytest): strip ansi codes from errors

This commit is contained in:
Rónán Carrigan
2025-09-19 12:16:58 +01:00
parent ed9b4d794b
commit 1b1b1abf92
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ end
---@param positions neotest.Tree
---@param root string
local function discover_params(python, script, path, positions, root)
local cmd = vim.tbl_flatten({ python, script, "--pytest-collect", path })
local cmd = vim.iter({ python, script, "--pytest-collect", path }):flatten():totable()
logger.debug("Running test instance discovery:", cmd)
local test_params = {}
@@ -66,7 +66,7 @@ local function discover_params(python, script, path, positions, root)
return {}
end
for line in vim.gsplit(data.stdout, "\n", true) do
for line in vim.gsplit(data.stdout, "\n", { plain = true }) do
local param_index = string.find(line, "[", nil, true)
if param_index then
local test_id = root .. lib.files.path.sep .. string.sub(line, 1, param_index - 1)