nvim-dap-python icon indicating copy to clipboard operation
nvim-dap-python copied to clipboard

Review/add behave support

Open ww-daniel-mora opened this issue 2 years ago • 1 comments

Add support for BDD tests via behave

ww-daniel-mora avatar Jul 18 '22 22:07 ww-daniel-mora

@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.

ww-daniel-mora avatar Aug 01 '22 17:08 ww-daniel-mora

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.

wookayin avatar Oct 28 '22 15:10 wookayin

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.

mfussenegger avatar Mar 09 '23 07:03 mfussenegger