disable tests in vanilla vim for #616

This commit is contained in:
Stanislav Seletskiy 2015-12-09 19:59:50 +06:00
parent 45e3775c18
commit 5a2dcc5cbf
3 changed files with 28 additions and 15 deletions

View File

@ -1,23 +1,10 @@
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
import subprocess
def has_patch(version, executable):
output = subprocess.check_output([executable, "--version"])
patch = 1
for line in output.decode('utf-8').split("\n"):
if line.startswith("Included patches:"):
patch = line.split('-')[1]
return int(patch) >= version
def check_required_vim_version(test):
if test.vim_flavor == 'neovim':
return None
if not has_patch(214, test.vim._vim_executable):
if not test.vim.has_patch(214):
return 'Vim newer than 7.4.214 is required'
else:
return None
@ -58,7 +45,7 @@ class Autotrigger_CanExpandOnTriggerWithLengthMoreThanOne(_VimTest):
class Autotrigger_WillProduceNoExceptionWithVimLowerThan214(_VimTest):
skip_if = lambda self: 'Vim older than 7.4.214 is required' \
if has_patch(214, self.vim._vim_executable) else None
if self.vim.has_patch(214) else None
files = { 'us/all.snippets': r"""
snippet abc "desc" A

View File

@ -1,6 +1,16 @@
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
def check_required_vim_version(test):
if test.vim_flavor == 'neovim':
return None
if not test.vim.has_patch(1):
return 'Vim newer than 7.4.1 is required'
else:
return None
# Undo of Snippet insertion {{{#
@ -122,11 +132,13 @@ class Backspace_TabStop_NotZero(_VimTest):
# End: Pressing BS in TabStop #}}}
class UpdateModifiedSnippetWithoutCursorMove(_VimTest):
skip_if = check_required_vim_version
snippets = ('test', '${1:one}(${2:xxx})${3:three}')
keys = 'test' + EX + 'aaaaa' + JF + BS + JF + '3333'
wanted = 'aaaaa()3333'
class UpdateModifiedSnippetWithoutCursorMove2(_VimTest):
skip_if = check_required_vim_version
snippets = ('test', '''\
private function ${1:functionName}(${2:arguments}):${3:Void}
{

View File

@ -91,6 +91,20 @@ class VimInterface(TempFileManager):
def __init__(self, vim_executable, name):
TempFileManager.__init__(self, name)
self._vim_executable = vim_executable
self._patch_version = None
def has_patch(self, version):
if self._patch_version is None:
output = subprocess.check_output([
self._vim_executable, "--version"
])
self._patch_version = 0
for line in output.decode('utf-8').split("\n"):
if line.startswith("Included patches:"):
self._patch_version = line.split('-')[1]
return int(self._patch_version) >= version
def get_buffer_data(self):
buffer_path = self.unique_name_temp(prefix='buffer_')