aports/community/py3-pynvim/fix-tests.patch
znley d2d7f3052a community/py3-pynvim: fix test test_vim failure
FAILED test/test_vim.py::test_python3 - pynvim.api.common.NvimError: nvim_exec2(): Vim(echomsg):E117: Unknown function: provider#python3#Prog
2024-07-09 08:05:46 +00:00

38 lines
1.5 KiB
Diff

From d18a007a2a0d5dac980eb8fd1a8f2cb376f0aead Mon Sep 17 00:00:00 2001
From: "Justin M. Keyes" <justinkz@gmail.com>
Date: Sun, 17 Mar 2024 00:19:21 +0100
Subject: [PATCH] fix(tests): "provider#python3#Prog" was removed upstream
Problem:
Tests fail since upstream Nvim commit https://github.com/neovim/neovim/commit/eb5d15e3838f53e2fcd25989c88db87458e9f984
which removed the (internal) `provider#python3#Prog` function.
pynvim.api.common.NvimError: nvim_exec2(): Vim(echomsg):E117: Unknown function: provider#python3#Prog
Solution:
Use the new Lua function instead.
---
test/test_vim.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/test/test_vim.py b/test/test_vim.py
index 58e305a3..3e140d68 100644
--- a/test/test_vim.py
+++ b/test/test_vim.py
@@ -208,10 +208,11 @@ def test_hash(vim: Nvim) -> None:
def test_python3(vim: Nvim) -> None:
"""Tests whether python3 host can load."""
- python3_prog = vim.command_output('echom provider#python3#Prog()')
- python3_err = vim.command_output('echom provider#python3#Error()')
- assert python3_prog != "", python3_err
- assert python3_prog == sys.executable
+ rv = vim.exec_lua('''
+ local prog, err = vim.provider.python.detect_by_module("neovim")
+ return { prog = prog, err = err }''')
+ assert rv['prog'] != "", rv['err']
+ assert rv['prog'] == sys.executable
assert sys.executable == vim.command_output(
'python3 import sys; print(sys.executable)')