feat: django support. (#54)

This commit is contained in:
Adrian Frischkorn
2023-12-10 20:15:08 +01:00
committed by GitHub
parent c969a5b007
commit 48bf141103
4 changed files with 140 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ M.module_exists = function(module, python_command)
return lib.process.run(vim.tbl_flatten({
python_command,
"-c",
"import imp; imp.find_module('" .. module .. "')",
"import " .. module,
})) == 0
end

View File

@@ -59,10 +59,10 @@ local get_runner = function(python_command)
if vim_test_runner == "pyunit" then
return "unittest"
end
if vim_test_runner and lib.func_util.index({ "unittest", "pytest" }, vim_test_runner) then
if vim_test_runner and lib.func_util.index({ "unittest", "pytest", "django" }, vim_test_runner) then
return vim_test_runner
end
local runner = base.module_exists("pytest", python_command) and "pytest" or "unittest"
local runner = base.module_exists("pytest", python_command) and "pytest" or base.module_exists("django", python_command) and "django" or "unittest"
stored_runners[command_str] = runner
return runner
end