From d20784c958a384e0b0c8d9502bdef7b058b0aa4b Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Mon, 3 Jun 2024 20:33:44 +0200 Subject: [PATCH] Detect pytest from pyproject.toml --- lua/dap-python.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/dap-python.lua b/lua/dap-python.lua index 37db23b..a504652 100644 --- a/lua/dap-python.lua +++ b/lua/dap-python.lua @@ -27,6 +27,17 @@ local function default_runner() return 'pytest' elseif uv.fs_stat('manage.py') then return 'django' + elseif uv.fs_stat("pyproject.toml") then + local f = io.open("pyproject.toml") + if f then + for line in f:lines() do + if line:find("%[tool.pytest") then + f:close() + return "pytest" + end + end + f:close() + end else return 'unittest' end