AckslD / nvim-pytrize.lua

Easily navigate pytest parametrize entries and fixtures with neovim
26 stars 1 forks source link

PytrizeJumpFixture: increase 5s plenary timeout: `pytest --fixtures -v` may take longer #6

Closed fnune closed 1 year ago

fnune commented 1 year ago
E5108: Error executing lua ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:499: 'pytest --fixtures -v' was unable to complete in 5000 ms
stack traceback:
        [C]: in function 'error'
        ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:499: in function 'wait'
        ...ocal/share/nvim/plugged/plenary.nvim/lua/plenary/job.lua:453: in function 'sync'
        ...im/plugged/nvim-pytrize.lua/lua/pytrize/jump/fixture.lua:54: in function 'lookup_fixtures'
        ...im/plugged/nvim-pytrize.lua/lua/pytrize/jump/fixture.lua:59: in function 'to_fixture_declaration'
        .../share/nvim/plugged/nvim-pytrize.lua/lua/pytrize/api.lua:53: in function 'jump_fixture'
        [string ":lua"]:1: in main chunk

Perhaps make it configurable, and ideally support showing a loading status. This may be easier with some sort of LSP integration, see https://github.com/AckslD/nvim-pytrize.lua/issues/7

Note that even if I do get this error message, PytrizeJumpFixture still (somehow) does its job and lands me on the fixture definition.

I'm on commit https://github.com/AckslD/nvim-pytrize.lua/commit/250bef11f9c7ee955e12727581747f651cb03af1 (the latest as of today).

AckslD commented 1 year ago

Thanks for the issue @fnune! Hmm, so pytest --fixtures -v takes more than 5 seconds for you?

fnune commented 1 year ago

Actually, a very strange thing is happening, thanks for prompting me to do this: pytest --fixtures -v says the timeout is 300s, and runs for that long if I don't send a signal to it. But if I do send a signal and I do it within 1-2 seconds, then the command succeeds (?!).

I'll try to figure this out and post a solution here in case it helps anyone else. It seems like it's not a problem with nvim-pytrize, so I'll close this. Thanks!

fnune commented 1 year ago

Looks like the weirdness I'm seeing is because I have a bunch of py-packages and I'm running pytest at the top level. If I run pytest --fixtures -v from the pytest-specific directory (where conftest.py lives) things work fine.

I wonder: can nvim-pytrize run pytest --fixtures -v (or whatever it runs under the hood) using as a CWD the directory of the closest conftest.py instead of Neovim's CWD?

AckslD commented 1 year ago

@fnune, so basically check upwards in the file hierarchy from the current file?

fnune commented 1 year ago

Yes, going up from the current file up to Neovim's cwd perhaps.

I can try to work on this once I find some time. Maybe it's not a problem many people are running into.

AckslD commented 1 year ago

I think that would make sense :+1:

Cool that would be great! I guess one could use vim.fs.parents() for that :)