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_discover_instances causes high memory usage on moderately sized projects #76

Open
craigrosie opened this issue Jun 12, 2024 · 0 comments

Comments

@craigrosie
Copy link

I haven't seen this reported anywhere else, so I'm not sure if I'm the only one having a problem or if there's something wrong with my configuration.

I work on a project with ~400 Python files, ~150 of which are tests. If I open buffers and navigate around the codebase, neotest-python starts running neotest-python/neotest.py --pytest-collect <test file> to collect all the tests.

Even after only opening a couple of files in my codebase, I have 45 neotest-python/neotest.py --pytest-collect <test file> processes running. Sometimes these are even running for the same <test file> - as I write this I have 8 processes running for the same test file path. Additionally, these processes don't seem to exit (although if I run the command manually myself e.g. .../python .../neotest-python/neotest.py --pytest-collect /<test file>, the command completes in ~0.5s).

This means that as I continue to work on my codebase in a single Neovim session, more and more of these "pytest collect" processes get started, and never complete. Each process takes ~190mb of memory, so eventually my machine runs out of memory and I get a Your system has run out of application memory alert before everything freezes and my machine force restarts.

I absolutely love neotest and neotest-python, and the use of pytest_discover_instances to enable discovery of parametrized tests is super useful, but unfortunately it's unusable for me at the moment 😢

My neotest/neotest-python is:

require("neotest").setup({
  adapters = {
    require("neotest-python")({ dap = { justMyCode = false }, args = { "-vv" }, pytest_discover_instances = true }),
  },
  quickfix = { enabled = false },
})

I'm running Neovim v0.10.0, 2e83d2b for neotest-python and nvim-neotest/neotest@f30bab1 for neotest.

I haven't had a chance to dig into the neotest-python code yet to see if there might be a simple fix, but I thought I'd raise this in case it's affecting others.

Please let me know if I can provide any more info to help debug!

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

1 participant