From 0f73fd610103b4e280081574267cd0031da976d4 Mon Sep 17 00:00:00 2001 From: Kleber Noel <42589399+klebster2@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:31:52 +0000 Subject: [PATCH] Update plugin.py --- python/plugin.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/python/plugin.py b/python/plugin.py index 6913651..6029d1b 100644 --- a/python/plugin.py +++ b/python/plugin.py @@ -10,12 +10,14 @@ def install(package: str): subprocess.check_call([sys.executable, "-m", "pip", "install", package]) -# This is the quick and dirty way to get packages installed if they are not already installed -try: - import vim # pylint: disable=import-error -except Exception as e: - print("No vim module available outside vim") - raise e +if "PYTEST_CURRENT_TEST" in os.environ: + # This is the quick and dirty way to get packages installed if they are not already installed + try: + import vim # pylint: disable=import-error + + except Exception as e: + print("No vim module available outside vim") + raise e try: import wn