nvim-neotest / neotest-python

MIT License
126 stars 38 forks source link

Tests not found with newest commits #6

Closed tbung closed 2 years ago

tbung commented 2 years ago

When I try to run a test pytest cannot find it. Pytest itself does work. I assume this is an error with the test path given to pytest. I am not sure if this should be an issue with neotest or neotest-python, since I can only test on python currently I opened it here.

================================================= test session starts ==================================================
platform darwin -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/tillb/Projects/debugging, configfile: setup.cfg
collected 0 items                                                                                                      

================================================ no tests ran in 0.00s =================================================
ERROR: file or directory not found: test_debugging.py::test_fib

Code to reproduce:

import pytest

def fib(n: int) -> int:
    if n < 2:
        return n
    else:
        return fib(n - 1) + fib(n - 2)

@pytest.mark.parametrize(
    ("input", "expected"), [(0, 0), (1, 1), (2, 1), (3, 2), (4, 3), (5, 5), (10, 55)]
)
def test_fib(input: int, expected: int):
    assert fib(input) == expected

Config:

require("neotest").setup({
  output = {
    enabled = true,
    open_on_run = "yes",
  },
  adapters = {
    require("neotest-python")({
      runner = "pytest",
      dap = { justMyCode = false, console = "integratedTerminal" },
    }),
  },
})
rcarriga commented 2 years ago

Can you provide the log file in stdpath("log") called neotest.log? There will be info on projects such as file structure so you can remove and rerun with a non-sensitive repo if that is a concern

rcarriga commented 2 years ago

Actually please try with latest neotest master, fixed a regression in the position tracking

tbung commented 2 years ago

That works, thanks for the quick fix!

I hope I'm not to spammy with my issues, I really like this plugin and am using it extensively already!

rcarriga commented 2 years ago

Glad to hear it works! No problem at all with issues, delighted to have them found quickly :grin: