Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chaudry-786 opened this issue Nov 20, 2023 · 1 comment
Open

Comments

@chaudry-786
Copy link

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).
@wookayin
Copy link
Contributor

When I go past the line with "assert"

by doing this you get out of "my code". After this line where error is thrown out of your code, it is catched by the pytest framework.

{ justMyCode = true },

you want DAP to handle your code only.

So they conflict by definition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants