test: Check for installed Python module with Vimscript function.

Use the existing Vimscript function provider#pythonx#Detect()
to determine whether the Neovim Python module is installed and
Python 2/3 tests can be run.
This commit is contained in:
Florian Walch
2015-09-22 14:33:08 +02:00
parent dbb5f41c97
commit 54596396bc
2 changed files with 22 additions and 22 deletions

View File

@@ -1,19 +1,19 @@
do
local proc = io.popen(
[[python3 -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]])
if proc:read() ~= 'ok' then
pending(
'python3 (or the python3 neovim module) is broken or missing',
function() end)
return
end
end
local helpers = require('test.functional.helpers')
local eval, command, feed = helpers.eval, helpers.command, helpers.feed
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
local expect, write_file = helpers.expect, helpers.write_file
do
command('let [g:interp, g:errors] = provider#pythonx#Detect(3)')
local errors = eval('g:errors')
if errors ~= '' then
pending(
'Python 3 (or the Python 3 neovim module) is broken or missing:\n' .. errors,
function() end)
return
end
end
describe('python3 commands and functions', function()
before_each(function()
clear()

View File

@@ -1,19 +1,19 @@
do
local proc = io.popen(
[[python -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]])
if proc:read() ~= 'ok' then
pending(
'python (or the python neovim module) is broken or missing',
function() end)
return
end
end
local helpers = require('test.functional.helpers')
local eval, command, feed = helpers.eval, helpers.command, helpers.feed
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
local expect, write_file = helpers.expect, helpers.write_file
do
command('let [g:interp, g:errors] = provider#pythonx#Detect(2)')
local errors = eval('g:errors')
if errors ~= '' then
pending(
'Python 2 (or the Python 2 neovim module) is broken or missing:\n' .. errors,
function() end)
return
end
end
describe('python commands and functions', function()
before_each(function()
clear()