From 698482ec3e02ede1e5fe3a4cb087df29b0e0e36c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 7 Aug 2015 16:10:22 -0400 Subject: [PATCH 1/3] test: python: report pending() if python{2,3} is missing --- .../runtime/autoload/provider/python3_spec.lua | 10 +++++----- .../runtime/autoload/provider/python_spec.lua | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/functional/runtime/autoload/provider/python3_spec.lua b/test/functional/runtime/autoload/provider/python3_spec.lua index 43889b7b2a..5be5390370 100644 --- a/test/functional/runtime/autoload/provider/python3_spec.lua +++ b/test/functional/runtime/autoload/provider/python3_spec.lua @@ -1,19 +1,19 @@ do - local proc = - io.popen([[python3 -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) + local proc = io.popen( + [[python3 -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) if proc:read() ~= 'ok' then - -- Don't run these tests if python3 is not available + 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 - describe('python3 commands and functions', function() before_each(function() clear() diff --git a/test/functional/runtime/autoload/provider/python_spec.lua b/test/functional/runtime/autoload/provider/python_spec.lua index e71a7a4309..ec1a853546 100644 --- a/test/functional/runtime/autoload/provider/python_spec.lua +++ b/test/functional/runtime/autoload/provider/python_spec.lua @@ -1,19 +1,19 @@ do - local proc = - io.popen([[python -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) + local proc = io.popen( + [[python -c 'import neovim, sys; sys.stdout.write("ok")' 2> /dev/null]]) if proc:read() ~= 'ok' then - -- Don't run these tests if python is not available + 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 - describe('python commands and functions', function() before_each(function() clear() From 62c53c404b6b7bc71c882fe6e620a9af972cb1fd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 7 Aug 2015 16:57:45 -0400 Subject: [PATCH 2/3] test: move runtime/autoload/* to provider/ - Organize tests by logical function, not the literal impl location. - Avoid deep nesting / hyper-hierarchy. --- .../{runtime/autoload/remote => provider}/define_spec.lua | 0 test/functional/{runtime/autoload => }/provider/python3_spec.lua | 0 test/functional/{runtime/autoload => }/provider/python_spec.lua | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename test/functional/{runtime/autoload/remote => provider}/define_spec.lua (100%) rename test/functional/{runtime/autoload => }/provider/python3_spec.lua (100%) rename test/functional/{runtime/autoload => }/provider/python_spec.lua (100%) diff --git a/test/functional/runtime/autoload/remote/define_spec.lua b/test/functional/provider/define_spec.lua similarity index 100% rename from test/functional/runtime/autoload/remote/define_spec.lua rename to test/functional/provider/define_spec.lua diff --git a/test/functional/runtime/autoload/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua similarity index 100% rename from test/functional/runtime/autoload/provider/python3_spec.lua rename to test/functional/provider/python3_spec.lua diff --git a/test/functional/runtime/autoload/provider/python_spec.lua b/test/functional/provider/python_spec.lua similarity index 100% rename from test/functional/runtime/autoload/provider/python_spec.lua rename to test/functional/provider/python_spec.lua From 5c1dc0fbe7388528875aff9d7b5055ad718014de Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 7 Aug 2015 18:25:03 -0400 Subject: [PATCH 3/3] test: fix pending() invocations AFAICT busted does not report pending() invocations without the 2nd argument. --- test/functional/legacy/077_mf_hash_grow_spec.lua | 2 +- test/functional/shell/viml_system_spec.lua | 4 ++-- test/unit/os/fs_spec.lua | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/functional/legacy/077_mf_hash_grow_spec.lua b/test/functional/legacy/077_mf_hash_grow_spec.lua index 01d916ef04..825f08e968 100644 --- a/test/functional/legacy/077_mf_hash_grow_spec.lua +++ b/test/functional/legacy/077_mf_hash_grow_spec.lua @@ -15,7 +15,7 @@ describe('mf_hash_grow()', function() -- Check to see if cksum exists, otherwise skip the test if os.execute('which cksum 2>&1 > /dev/null') ~= 0 then - pending("was not tested because cksum was not found") + pending('was not tested because cksum was not found', function() end) else it('is working', function() execute('set fileformat=unix undolevels=-1') diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index 6e10715612..4985c24aec 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -186,7 +186,7 @@ describe('system()', function() describe("with a program that doesn't close stdout", function() if not xclip then - pending('skipped (missing xclip)') + pending('skipped (missing xclip)', function() end) else it('will exit properly after passing input', function() eq('', eval([[system('xclip -i -selection clipboard', 'clip-data')]])) @@ -365,7 +365,7 @@ describe('systemlist()', function() describe("with a program that doesn't close stdout", function() if not xclip then - pending('skipped (missing xclip)') + pending('skipped (missing xclip)', function() end) else it('will exit properly after passing input', function() eq({}, eval( diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 20aca9109e..f7f0cba951 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -270,7 +270,7 @@ describe('fs function', function() -- Some systems may not have `id` utility. if (os.execute('id -G > /dev/null 2>&1') ~= 0) then - pending('skipped (missing `id` utility)') + pending('skipped (missing `id` utility)', function() end) else it('owner of a file may change the group of the file to any group of which that owner is a member', function() local file_gid = lfs.attributes(filename, 'gid') @@ -296,7 +296,7 @@ describe('fs function', function() -- On Windows `os_fchown` always returns 0 -- because `uv_fs_chown` is no-op on this platform. if (ffi.os == 'Windows' or ffi.C.geteuid() == 0) then - pending('skipped (os_fchown is no-op on Windows)') + pending('skipped (os_fchown is no-op on Windows)', function() end) else it('returns nonzero if process has not enough permissions', function() -- chown to root