Closed victorfernandesraton closed 7 months ago
test_method
goes through the same virtualenv detection as other configurations referring the debugpy adapter created by nvim-dap-python.
test_method
goes through the same virtualenv detection as other configurations referring the debugpy adapter created by nvim-dap-python.
But this behavior is not default when you append some configurations for create custon runs such as:
table.insert(require('dap').configurations.python, {
type = 'python',
request = 'launch',
name = 'Run handler.py RPA',
program = 'handler.py',
console = "integratedTerminal",
})
I created a manual patch for this cases in my config for now in these functions above
local is_windows = function()
return vim.fn.has("win32") == 1
end
local function python_exe(venv)
if is_windows() then
return venv .. '\\Scripts\\python.exe'
end
return venv .. '/bin/python'
end
local get_python_path = function()
local venv_path = os.getenv('VIRTUAL_ENV')
if venv_path then
return python_exe(venv_path)
end
venv_path = os.getenv("CONDA_PREFIX")
if venv_path then
if is_windows() then
return venv_path .. '\\python.exe'
end
return venv_path .. '/bin/python'
end
end
And add as a pythonPath
in custon configurations like
table.insert(dap.configurations.python, {
type = 'python',
request = 'launch',
name = 'Run handler.py RPA',
program = 'handler.py',
console = "integratedTerminal",
pythonPath = get_python_path()
})
I guess it's has something about sane default behavior here?
Description
When i try to use
test_method
ortest_class
itś seens it not apply path verification, run in$HOME/.local/share/nvim/mason/packages/debugpy/venv/bin/python
instead of select runtime from current virtualenv, but when i usecontinue
, seens work fineSteps to reproduce
I currently using
:checkhealth
and have this results aboveAlso i use this config file
And i have pytest.ini file, but when i run using
test_method
, i got this result