nvim-neotest / neotest-python

MIT License
116 stars 34 forks source link

No tests found if another adapter is registered as well #75

Closed HiPhish closed 3 weeks ago

HiPhish commented 1 month ago

My configuration is as follows:

local adapters = {
    require 'neotest-python' {
        runner = 'pytest',
        dap = {
            justMyCode = false
        },
    },
    require 'neotest-busted',
}

As you can see there are two adapter registered: neotest-python and neotest-busted. However, as long as neotest-busted is in the list no Python tests are found. Once I remove it everything works fine. The is_test_file function from the Python adapter is never called, only the one from the busted adapter.

Maybe I am misunderstanding how adapters get chose, but my expectation would have been that Neotest tries the is_test_file functions from all adapters until one succeeds. Is there something about neotest-busted that makes it clobber neotest-python?

MijikHna commented 1 month ago

I am facing the same issue. @HiPhish have you found a solution?

HiPhish commented 1 month ago

@MijikHna No, but I have not been looking into it either.

ramboman commented 3 weeks ago

I had the same problem when I tried to register neotest-bash along side with neotest-python. I posted an issue regarding this problem at rcasia/neotest-bash#17. @rcasia's response explains properly what is going on. @rcarriga's response for another issue offers a solution to the problem.

MijikHna commented 3 weeks ago

@ramboman Thank you for your hint. I have just created a python project file (in my case pyproject.toml) and tests has been discovered.

HiPhish commented 3 weeks ago

@ramboman Thanks, that helped. I have taken out the fallback to the current working directory from my adapter, now everything works fine. I'm closing this issue.