neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.47k stars 118 forks source link

test: always use the same exact python executable regardless of $PATH #547

Closed wookayin closed 7 months ago

wookayin commented 8 months ago

Problem: The embedded neovim fixture instance for testing picks up python3 on the $PATH. This can be different from the current python.

(Example)

$ which python3
/usr/local/bin/python3
$ which python3.11
$HOME/.pyenvs/versions/3.11.5/bin/python3.11

$ python3.11 -m pytest

then neovim will have /usr/local/bin/python3 as the python3 host, so the behavior of :python (and pynvim especially when it has local changes during development) can be different.

Solution: The embedded nvim instance should always pin g:python3_host_prog to sys.executable.