nvim-neotest / nvim-neotest/neotest-python

No tests are being recognized within test files

Open
#83 13 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
192
Forks
60
PR merge metrics
No merged PRs in 30d

Description

It seems no tests within files are being discovered - when running file, or running nearest, or debugging nearest the result is "No tests found" from neotest. The test file, however, does show up in the summary window, but shows a "skipped" icon next to it when run.
image

I created a fresh venv with python 3.12, and installed just pytest 8.3.3, and implemented their getting started:

# filename: test_sample.py
def func(x):
    return x + 1

def test_sample():
    assert func(3) == 5

class TestClass:
    def test_one(self):
        x = "this"
        assert "h" in x

    def test_two(self):
        x = "hello"
        assert hasattr(x, "check")

Running pytest yields the following, expected, output:
image

Here's my output of nvim -v:

% nvim -v
NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.1703358377
Run "nvim -V1 -v" for more info

And I'm running LazyVim - here's the lazy-lock.json lines for neotest:

  "neotest": { "branch": "master", "commit": "6d6ad113f56edc7c3f2a77a0836ea8c1b955ebea" },
  "neotest-python": { "branch": "master", "commit": "72603dfdbaad5695160268cb10531a14cc37236e" },

and the rest of my configuration is here: https://github.com/a3ng7n/nvim

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided test_sample.py, pytest 8.3.3, Neovim v0.11.0-dev, and the pinned neotest and neotest-python commits. Trace test discovery for running a file, nearest test, and debugging nearest; done means the tests appear in the summary and execute instead of showing "No tests found" or "skipped".

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.