nvim-dap-python
nvim-dap-python copied to clipboard
Add support for passing args to runners
This allows users to customize runner commands with a table of args to add to the test runner call.
from my config:
" DAP - debug adapter protocol
lua require("dap-python").setup("~/.virtualenvs/debugpy/bin/python")
lua require("dap-python").test_runner = 'pytest'
lua require("dap-python").args = {'-v'}
In this example it prints assertion failures more verbosely (tested locally).
(fair warning - I don't know lua, but it works so figured I'd offer a PR)
This will also come in very handy for a future possible https://github.com/mfussenegger/nvim-dap-python/issues/63 implementation, which is often executed via tox -e <environment>
Thanks for the PR.
I'm not sure how I feel about the interface. It's global and would apply to all runners, and it's also not clear that it only applies to runners and not other launch configurations.
It would already be possible to do something like this by adding a custom runner function:
local pytest = M.test_runners.pytest
require('dap-python').test_runners.pytest = function(...)
local module, args = pytest(...)
table.insert(args, '-v')
return module, args
end
Thanks for the consideration and response @mfussenegger.
I'll close this PR in favor of existing functionality.