Closed stevanmilic closed 2 years ago
Running in to the same issue with RSpec tests.
When running with lua require("neotest").run.run(vim.fn.expand("%"))
tests are running in parallel and failing due to deadlock.
Unfortunately due to simplicity of the adapter (it doesn't do any parsing/runner integration) it relies on exit codes to get results for each test and so requires running tests separately. For pytest you should use neotest-python instead. For other runners without adapters I can add an option to not run tests concurrently but then it will be a good bit slower. That's what this adapter is a last resort
Got it, thanks! I assumed it's something like that by reading the README file. I used this plugin instead of neotest-python
since I couldn't pass extra arguments to the test command. I tried using extra_args
on neotest.run.run(...)
but it didn't work. Any suggestions there @rcarriga ? To that remark, is it possible to configure default adapter args, similar to let test#python#pytest#options = '-s --tb=short -p no:warnings'
in vim-test?
Ah I've fixed the issue with extra args thanks for flagging! Also you can pass an args
option to the neotest-python settings which can be a list of strings or a function. Need to add some more documentation :sweat_smile:
@rcarriga args
do work right now, but if I have different set of args for pyunit
and pytest
– how do I specify that?
EDIT: A function could be passed, from looking at the code the first param is the runner
and this works 🎉 :
require("neotest-python")({
args = function(runner, _)
if runner == "pytest" then
return { "-s", "--tb=short", "-p", "no:warnings" }
else
return {}
end
end,
})
I've created a PR to document this https://github.com/rcarriga/neotest/pull/16
When running
lua require("neotest").run.run(vim.fn.expand("%"))
with vim-test, every test case (function) is executed in a different process, causing error behavior if multiple tests are causal in any way e.g. when runningpytest
on a file in which there are tests that all use the same database – they can't work in parallel.