nvim-neotest / neotest-python

MIT License
126 stars 38 forks source link

Add support for nose2 #22

Open valentingregoire opened 1 year ago

valentingregoire commented 1 year ago

Nose2 is also a test runner. It would be cool if that would be supported as well.

rcarriga commented 1 year ago

Happy to add support but I've never used nose2 so I have idea on what's required and can't say it'll be a priority. I'd be happy to help anyone who wishes to contribute though!

valentingregoire commented 1 year ago

I am trying to implement it myself, but I'm having a hard time understanding the code so far. I'll see if I find time to complete it.

rcarriga commented 1 year ago

The main thing needed is a runner adapter class in the python code which will be added to this function https://github.com/rcarriga/neotest-python/blob/9e2db9375c02aa2b7fe1e7017d233ec2de20ee58/neotest_python/__init__.py#L14

The class just needs to implement a run method which will take the list of arguments for the runner and a callback for streamed results (I wouldn't worry about streaming for the initial implementation). It should return a dict of position IDs to result dicts, you can see typeddict definitions for the results here https://github.com/rcarriga/neotest-python/blob/9e2db9375c02aa2b7fe1e7017d233ec2de20ee58/neotest_python/base.py#L18-L25

Depending on how similar nose is to pytest/unittest for how tests are structured that should be all that's needed, apart from updating docs :smile: