From 50f9d74ee160e539c5662cbde5c3b0ccd4e27fb3 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Sat, 30 Sep 2023 16:29:23 -0400 Subject: [PATCH] fix: make pytest always pick up the same python as rplugin host (even if the python interpreter and $PATH is different) --- test/test_plugin.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/test_plugin.py b/test/test_plugin.py index 3c01a54..1432db3 100644 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -1,4 +1,5 @@ import os +import sys import time import pynvim @@ -59,10 +60,14 @@ def wait_for_update_thread(self): ) +NVIM_ARGV = ['nvim', '-i', 'NONE', '--embed', '--headless', + '--cmd', 'let g:python3_host_prog="{}"'.format(sys.executable), + '-u', VIMRC] + + @pytest.fixture(scope='function') def vim(): - argv = ['nvim', '-u', VIMRC, '--embed', '--headless'] - vim = pynvim.attach('child', argv=argv) + vim = pynvim.attach('child', argv=NVIM_ARGV) return WrappedVim(vim) @@ -71,8 +76,7 @@ def start_vim(tmp_path): def f(argv=None, file=None): if argv is None: argv = [] - argv = ['nvim', '-i', 'NONE', '--embed', '--headless', - '-u', VIMRC, *argv] + argv = list(NVIM_ARGV) + list(argv) vim = pynvim.attach('child', argv=argv) if file is not None: fn = file or (tmp_path / 'foo.py')