Giter VIP home page Giter VIP logo

Comments (19)

rcarriga avatar rcarriga commented on July 19, 2024 1

OK I can reproduce with that thanks! Will investigate further

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024 1

You can check your runtime files to see if the fix is present (you can see it's just a small change https://github.com/neovim/neovim/pull/18794/files) as well. If it is then it might be worth re-raising. I can help with creating a reproduction

from neotest.

tbung avatar tbung commented on July 19, 2024

Maybe you can tell if there is an obvious reason for this @stevearc.

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

I'm not seeing this issue, could you provide your config for neotest and neotest-python?

from neotest.

tbung avatar tbung commented on July 19, 2024

Ya, I also can only reproduce it in this one project and not in an attempt of a minimal example, with the previous commit both work, I have no clue why. I will investigate further and report back.

from neotest.

tbung avatar tbung commented on July 19, 2024

Here is the config, I'll provide an example once I know what makes this one project special:

    use("rcarriga/neotest-python")
    use({
      "rcarriga/neotest",
      -- commit = "0cabaff54051474c997964b0fdfc5d95dc35dbfd",
      requires = {
        "nvim-lua/plenary.nvim",
        "nvim-treesitter/nvim-treesitter",
        "antoinemadec/FixCursorHold.nvim",
      },
      config = function()
        require("neotest").setup({
          output = {
            enabled = true,
            open_on_run = "yes",
          },
          adapters = {
            require("neotest-python")({
              runner = "pytest",
              -- dap = { justMyCode = false, console = "integratedTerminal" },
            }),
          },
        })
      end,
    })

from neotest.

tbung avatar tbung commented on July 19, 2024

Ok, so I investigated further, and the latest commit fails if there is a comment after the test, at least in python. This only happens the first time you try to run the test, once it has found the test you can add the comment and it works. The following example reproduces this for me, if you remove the comment everything works.

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


# test

from neotest.

tbung avatar tbung commented on July 19, 2024

Actually, it can't handle any comments in the code, no matter where you put it.

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

Ah found this neovim/neovim#18790 which is the same issue. Was fixed in master 8 days ago so just updating NeoVim will fix

from neotest.

tbung avatar tbung commented on July 19, 2024

Afaik im on neovim/neovim@6eaf105 so second to latest commit and can still reproduce the issue. Is it fixed for you? Maybe I gotta delete ~/.local/nvim.

from neotest.

stevearc avatar stevearc commented on July 19, 2024

I was able to repro this in the commit right before the fix (d93ba03c717bee05fe6d239fd7faefe6e9698c85), but when I update to e15d31b53 and rebuild the issue goes away

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

Yep can confirm it worked for me once I updated

from neotest.

tbung avatar tbung commented on July 19, 2024

Yup, works for me now, too. Thanks, you guys!

from neotest.

joshbode avatar joshbode commented on July 19, 2024

If I have any comments in a python test file, I'm still seeing the problem above, with the latest everything:

from neotest.

joshbode avatar joshbode commented on July 19, 2024

I'm seeing this error show up in ~/.local/state/nvim/neotest.log:

ERROR | 2022-06-22T13:51:16Z+1000 | ...te/pack/packer/start/neotest/lua/neotest/client/init.lua:419 | Couldn't find positions in path /home/josh/scratch/test_fib.py ...r/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:115: Ranges can only be made from 6 element long tables or nodes.

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

Can't reproduce unfortunately, can't really offer any advice except try wiping the neovim (make sure to start from fresh when building too make distclean) install and re-installing.

from neotest.

joshbode avatar joshbode commented on July 19, 2024

thanks @rcarriga - I've tried a fresh rebuild, installing nightly using nix and even the nightly nvim.appimage but I get the same effect.
I even reinstalled the python tree-sitter parser :)

If I figure out what's different, I'll post here!

from neotest.

joshbode avatar joshbode commented on July 19, 2024

Ugh - I'm sorry for the noise - I've got it working now!

I think what has happened is that a stray LD_LIBRARY_PATH in my .profile left over from an experiment was picking up a different version of libtree-sitter.so, which was producing an unexpected structure. Looking at the critical code you posted above and what it is doing helped trigger that chain of thought - thank you @rcarriga :)

from neotest.

rcarriga avatar rcarriga commented on July 19, 2024

Ah good to hear 👍

from neotest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.