Skip to content

Commit

Permalink
fix: make pytest always pick up the same python as rplugin host
Browse files Browse the repository at this point in the history
(even if the python interpreter and $PATH is different)
  • Loading branch information
wookayin committed Sep 30, 2023
1 parent 8aae1ec commit 50f9d74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import time

import pynvim
Expand Down Expand Up @@ -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)


Expand All @@ -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')
Expand Down

0 comments on commit 50f9d74

Please sign in to comment.