From 99eede1bf60473cf1bb12c17cada159ac28012f9 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Sat, 18 Apr 2015 17:15:05 +0200 Subject: [PATCH] Started to test py2 and py3 on travis now. I also learned that Vim 7.3 does not seem to be working at all anymore. Fixes a bug that only happens with python3. --- .travis.yml | 18 +++--- autoload/UltiSnips/bootstrap.vim | 2 +- doc/UltiSnips.txt | 7 +-- install_vim.sh | 61 +++++++++++++++++++ .../snippet/source/_snippet_dictionary.py | 2 +- test/vim_test_case.py | 1 + 6 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 install_vim.sh diff --git a/.travis.yml b/.travis.yml index c0aa297..0d29807 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,15 @@ language: python python: - # TOOD: add support for one python3 version. The problem here is Vim: we need to install a version of vim that - # has py3, but not py2. I could not figure this out so far. - 2.7 + - 3.3 + - 3.4 +env: + - VIM_VERSION="74" + +install: sudo ./install_vim.sh "${VIM_VERSION}" "$(python --version 2>&1)" + before_script: - # Clone the dependent plugins we want to use. - - ./test_all.py --clone-plugins - # Install tmux (> 1.8) and vim. - - sudo add-apt-repository ppa:kalakris/tmux -y - - sudo apt-get update -qq - - sudo apt-get install -qq -y tmux vim-gnome - # Start the testing session. - tmux new -d -s vim - - vim --version + script: ./test_all.py -v --plugins --interface tmux --session vim diff --git a/autoload/UltiSnips/bootstrap.vim b/autoload/UltiSnips/bootstrap.vim index e4905aa..d61f261 100644 --- a/autoload/UltiSnips/bootstrap.vim +++ b/autoload/UltiSnips/bootstrap.vim @@ -11,7 +11,7 @@ function! UltiSnips#bootstrap#Bootstrap() if !has("python3") if !has("python") if !exists("g:UltiSnipsNoPythonWarning") - echo "UltiSnips requires py >= 2.6 or any py3" + echo "UltiSnips requires py >= 2.7 or any py3" endif unlet g:_uspy return diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index bacacd6..dbbe8fa 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -74,12 +74,11 @@ http://www.sirver.net/blog/2012/03/31/fourth-episode-of-ultisnips-screencast/ 1.1 Requirements *UltiSnips-requirements* ---------------- -This plugin works with Vim version 7.0 or later. It only works if the +This plugin works with Vim version 7.4 or later. It only works if the 'compatible' setting is not set. -This plugin requires python >= 2.6. It has been specifically tested using -python 2.7 and python 3.2 but should theoretically work on all versions of -python >= 2.6. +This plugin is tested against Python 2.7, 3.3 or 3.4. All other versions are +unsupported, but might work. The Python 2.x or Python 3.x interface must be available. In other words, Vim must be compiled with either the |+python| feature or the |+python3| feature. diff --git a/install_vim.sh b/install_vim.sh new file mode 100644 index 0000000..8b9652f --- /dev/null +++ b/install_vim.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# Installs a known version of vim in the travis test runner. +set -ex + +VIM_VERSION=$1; shift +PYTHON_VERSION=$1; shift + +build_vanilla_vim () { + URL=$1; shift; + + mkdir vim_build + pushd vim_build + + curl $URL -o vim.tar.bz2 + tar xjf vim.tar.bz2 + cd vim${VIM_VERSION} + + PYTHON_BUILD_CONFIG="" + if [[ $PYTHON_VERSION =~ "Python 2." ]]; then + PYTHON_BUILD_CONFIG="--enable-pythoninterp" + else + PYTHON_BUILD_CONFIG="--enable-python3interp" + fi + ./configure \ + --prefix=${HOME} \ + --disable-nls \ + --disable-sysmouse \ + --disable-gpm \ + --enable-gui=no \ + --enable-multibyte \ + --with-features=huge \ + --with-tlib=ncurses \ + --without-x \ + ${PYTHON_BUILD_CONFIG} + + make install + popd + + rm -rf vim_build +} + +# Clone the dependent plugins we want to use. +./test_all.py --clone-plugins + +# Install tmux (> 1.8) and vim. +add-apt-repository ppa:kalakris/tmux -y +apt-get update -qq +apt-get install -qq -y tmux + +if [[ $VIM_VERSION == "74" ]]; then + build_vanilla_vim ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 +else + echo "Unknown VIM_VERSION: $VIM_VERSION" + exit 1 +fi + +# Dirty hack, since PATH seems to be ignored. +ln -sf /home/travis/bin/vim /usr/bin/vim + +vim --version diff --git a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py index a4ae05e..197cf8b 100644 --- a/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py +++ b/pythonx/UltiSnips/snippet/source/_snippet_dictionary.py @@ -11,7 +11,7 @@ class SnippetDictionary(object): def __init__(self): self._snippets = [] self._cleared = {} - self._clear_priority = None + self._clear_priority = float("-inf") def add_snippet(self, snippet): """Add 'snippet' to this dictionary.""" diff --git a/test/vim_test_case.py b/test/vim_test_case.py index f5f39f9..e473af6 100644 --- a/test/vim_test_case.py +++ b/test/vim_test_case.py @@ -32,6 +32,7 @@ class VimTestCase(unittest.TestCase, TempFileManager): # Skip this test for the given reason or None for not skipping it. skip_if = lambda self: None version = None # Will be set to vim --version output + maxDiff = None # Show all diff output, always. def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs)