From 054f22129405e747adfc2cbeddfcc59537df50ba Mon Sep 17 00:00:00 2001 From: Sebastian Kohn Date: Tue, 4 Jul 2023 21:45:45 +0200 Subject: [PATCH] fix: detect poetry env outside of poetry shell (#49) If you are not in a `poetry shell`, the venv detection does not work. This patch prepends `poetry run` before `poetry env info -p`, which makes venv detection work both inside and outside the poetry subshell. --- lua/neotest-python/base.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/neotest-python/base.lua b/lua/neotest-python/base.lua index 9ffb300..90f703e 100644 --- a/lua/neotest-python/base.lua +++ b/lua/neotest-python/base.lua @@ -56,7 +56,7 @@ function M.get_python_command(root) if lib.files.exists("pyproject.toml") then local success, exit_code, data = pcall( lib.process.run, - { "poetry", "env", "info", "-p" }, + { "poetry", "run", "poetry", "env", "info", "-p" }, { stdout = true } ) if success and exit_code == 0 then