nvim-dap-python
nvim-dap-python copied to clipboard
Review/add behave support
Add support for BDD tests via behave
@mfussenegger The filetype checking and the tree sitter queries caused me to split the API and make BDD a separate type. I like the idea of not expanding the API surface but I just could not come up with a way to achieve that. I can spend some more time thinking about it, but, if you have suggestions I'm all ears.
In practice I am using autocommands to map keys to trigger_test
and trigger_bdd_test
depending on the file type so the user API (keyboard commands) can still be narrow and I was comfortable putting that file type detection and smarts at the user level rather than inside nvim-dap-python.
Re: formatting - got it. I just have format-on-save enabled and decided it was more good than harm to leave the formatting changes in rather back them out with format-on-save turned off. GitHub has a flag to hide whitespace changes as well which I find helpful.
My two cents: Isn't this too specific to have for nvim-dap-python? I don't think the testing framework choice (https://github.com/behave/behave) here is quite usual, compared to popular unit test runners (standard unittest, pytest, etc.) which nvim-dap-python doesn't support as a built-in.
I believe such BDD integrations could be implemented outside somewhere (as a separate plugin), or by just providing some DAP configurations (at least a separate file/extension) rather than new lua APIs, for the sake of less decoupling. For instance, neotest-python implements a DAP strategy and provides a DAP launch configuration.
I gave this some more thought and I think I agree with @wookayin.
The logic doesn't use any internals of nvim-dap-python so it could easily be implemented in a separate plugin. As long as users have a python adapter definition - either from nvim-dap-python or by setting it manually - it would work and compose well.