nvim-neotest / neotest-python

MIT License
126 stars 38 forks source link

No tests found by neotest-python #17

Closed NostraDavid closed 1 year ago

NostraDavid commented 1 year ago

Had trouble getting this adapter to find my tests and got the "no tests found" notification.

I checked the log, as mentioned in this issue on neotest itself, but found nothing wrong (other than there was no mention that files were found, which started to ring a bell).

I had this code in my config, because part of it was part of the example config in the README.md:

is_test_file = function(file_path)
  return vim.startswith(file_path, "test_")
end,

Turns out this doesn't work. Nor did this:

is_test_file = function(file_path)
  return file_path:find("^test_") ~= nil
end,

Solution:

Don't use is_test_file, by either removing the is_test_file or commenting it out! The default behavior works just fine.

NostraDavid commented 1 year ago

So yes, my problem has already been solved.

However, to ensure others don't need to suffer the same problem, I figure I'd post it here :)

However, maybe you want to add an example of a working version to the README, or perhaps add a mention that if no tests are found, it would help to turn the function off?

rcarriga commented 1 year ago

The default version already does exactly what you want and the README states the configuration values are optional. I don't see any need to add an example that people will unfortunately probably blindly copy and paste with no need, hence why the given one is not valid lua.