Skip to content

Commit 03fe959

Browse files
committed
Fix missing method case handling in test_method
Should print "No test method found near cursor" instead of a stacktrace if there is no function
1 parent db72bf6 commit 03fe959

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/dap-python.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ end
451451
function M.test_method(opts)
452452
opts = vim.tbl_extend('keep', opts or {}, default_test_opts)
453453
local functions = M._get_nodes(0, "function")
454-
if not functions then
454+
if not functions or not functions[1] then
455455
print('No test method found near cursor')
456456
return
457457
end

0 commit comments

Comments
 (0)