nvim-neotest / nvim-neotest/neotest-python

pytest file opens on "assert" despite "JustMyCode" set to true.

Open
#58 2 comments 1 reaction 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

Hello, my config is bare minimum and I only want my code debugged.

keymap("n", "<Leader>dt", ":lua require('neotest').run.run({strategy = 'dap'})<CR>", opts)
require("neotest").setup({
    adapters = {
        require("neotest-python")({
            dap = { justMyCode = true },
            python = venv_dir .. "python",
            runner = "pytest",
        })
    }
})

Take this test for example:

def test_addition():
    dic = {"name": "cat"}
    json.dumps(dic)
    assert 2 + 3 == 5

When I go past the line with "assert", then file "~/.local/share/nvim/lazy/neotest-python/neotest_python/pytest.py" and function "pytest_runtest_makereport" opens. I just want to debug my code. Interestingly if I try to "step in" at "json.dumps(dic)", I correctly get this message:

Note: may have been skipped because of "justMyCode" option (default == true).

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

Reproduce the provided pytest debugging case with the neotest-python configuration and the nvim DAP strategy. Start in ~/.local/share/nvim/lazy/neotest-python/neotest_python/pytest.py at pytest_runtest_makereport, then compare the behavior after stepping over assert with the justMyCode message seen at json.dumps(dic). Done means pytest internals no longer open while debugging user code with justMyCode enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
neovim, python
Domain
devtools, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.