From 9ae76a99712b5eff5c609fbbb277ab79933049ef Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 10 Dec 2014 08:36:27 +0300 Subject: [PATCH] Use UCS2 Python versions for running tests --- .travis.yml | 6 ++++++ tests/install.sh | 31 ++++++++++++++++++++++--------- tests/run_vim_tests.sh | 20 ++++++++++++-------- tests/test.sh | 13 ++++++++++++- tests/test_shells/test.sh | 1 + tests/test_watcher.py | 2 +- 6 files changed, 54 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88ff9017..7794e659 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,11 @@ matrix: - python: "3.4" - python: "pypy" - python: "pypy3" + - env: >- + USE_UCS2_PYTHON=1 + UCS2_PYTHON_VARIANT="2.6" + - env: >- + USE_UCS2_PYTHON=1 + UCS2_PYTHON_VARIANT="2.7" # vim: et diff --git a/tests/install.sh b/tests/install.sh index da487856..b53ebda2 100755 --- a/tests/install.sh +++ b/tests/install.sh @@ -4,18 +4,31 @@ git clone --depth=1 git://github.com/powerline/deps tests/bot-ci/deps . tests/bot-ci/scripts/common/main.sh +sudo apt-get install -qq screen zsh tcsh mksh busybox socat realpath + if test -n "$USE_UCS2_PYTHON" ; then - for variant in $UCS2_PYTHON_VARIANTS ; do - archive="${PWD:-$(pwd)}/tests/bot-ci/deps/cpython-ucs2/cpython-ucs2-${variant}.tar.gz" - sudo sh -c "cd /opt && tar xzvf $archive" - done + pip install virtualenvwrapper + set +e + . virtualenvwrapper.sh + set -e + archive="${PWD:-$(pwd)}/tests/bot-ci/deps/cpython-ucs2/cpython-ucs2-${UCS2_PYTHON_VARIANT}.tar.gz" + sudo sh -c "cd /opt && tar xzf $archive" + PYTHON="/opt/cpython-ucs2-$UCS2_PYTHON_VARIANT/bin/python$UCS2_PYTHON_VARIANT" + export LD_LIBRARY_PATH=/opt/cpython-ucs2-$UCS2_PYTHON_VARIANT/lib + set +e + mkvirtualenv -p "$PYTHON" cpython-ucs2-$UCS2_PYTHON_VARIANT + set -e + pip install . + pip install --no-deps tests/bot-ci/deps/wheels/ucs2-CPython-${UCS2_PYTHON_VARIANT}*/*.whl +else + pip install . + pip install --no-deps tests/bot-ci/deps/wheels/$PYTHON_SUFFIX/*.whl + if test "$PYTHON_IMPLEMENTATION" = "CPython" ; then + archive="${PWD:-$(pwd)}/tests/bot-ci/deps/zpython/zsh-${PYTHON_VERSION}.tar.gz" + sudo sh -c "cd /opt && tar xzf $archive" + fi fi -pip install . - -pip install --no-deps tests/bot-ci/deps/wheels/$PYTHON_SUFFIX/*.whl - -sudo apt-get install -qq screen zsh tcsh mksh busybox socat # Travis has too outdated fish. It cannot be used for tests. # sudo apt-get install fish true diff --git a/tests/run_vim_tests.sh b/tests/run_vim_tests.sh index d1533180..cffeb76e 100755 --- a/tests/run_vim_tests.sh +++ b/tests/run_vim_tests.sh @@ -3,15 +3,19 @@ FAILED=0 if test -z "$VIM" ; then - if test "$PYTHON_IMPLEMENTATION" != "CPython" ; then - exit 0 - fi - NEW_VIM="$PWD/tests/bot-ci/deps/vim/tip-$PYTHON_VERSION/vim" - OLD_VIM="$PWD/tests/bot-ci/deps/vim/v7-0-112-$PYTHON_VERSION/vim" - if test -e "$OLD_VIM" ; then - VIMS="NEW_VIM OLD_VIM" + if test -n "$USE_UCS2_PYTHON" ; then + NEW_VIM="$PWD/tests/bot-ci/deps/vim/tip-$UCS2_PYTHON_VARIANT-double/vim" else - VIMS="NEW_VIM" + if test "$PYTHON_IMPLEMENTATION" != "CPython" ; then + exit 0 + fi + NEW_VIM="$PWD/tests/bot-ci/deps/vim/tip-$PYTHON_VERSION/vim" + OLD_VIM="$PWD/tests/bot-ci/deps/vim/v7-0-112-$PYTHON_VERSION/vim" + if test -e "$OLD_VIM" ; then + VIMS="NEW_VIM OLD_VIM" + else + VIMS="NEW_VIM" + fi fi else NEW_VIM="$VIM" diff --git a/tests/test.sh b/tests/test.sh index c1195f3f..f28ba38b 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,5 +1,16 @@ -#!/bin/sh +#!/bin/bash +. tests/bot-ci/scripts/common/main.sh + FAILED=0 + +if test -n "$USE_UCS2_PYTHON" ; then + export LD_LIBRARY_PATH=/opt/cpython-ucs2-$UCS2_PYTHON_VARIANT/lib + set +e + . virtualenvwrapper.sh + workon cpython-ucs2-$UCS2_PYTHON_VARIANT + set -e +fi + export PYTHON="${PYTHON:=python}" export PYTHONPATH="${PYTHONPATH}:`realpath .`" for script in tests/run_*_tests.sh ; do diff --git a/tests/test_shells/test.sh b/tests/test_shells/test.sh index 5ad1bbfe..698264d4 100755 --- a/tests/test_shells/test.sh +++ b/tests/test_shells/test.sh @@ -73,6 +73,7 @@ run() { DIR2="${DIR2}" \ XDG_CONFIG_HOME="$PWD/tests/shell/fish_home" \ IPYTHONDIR="$PWD/tests/shell/ipython_home" \ + PYTHONPATH="${PWD}${PYTHONPATH:+:}$PYTHONPATH" \ POWERLINE_SHELL_CONTINUATION=$additional_prompts \ POWERLINE_SHELL_SELECT=$additional_prompts \ POWERLINE_COMMAND="${POWERLINE_COMMAND} -p $PWD/powerline/config_files" \ diff --git a/tests/test_watcher.py b/tests/test_watcher.py index dce37bae..571cc8c4 100644 --- a/tests/test_watcher.py +++ b/tests/test_watcher.py @@ -16,7 +16,7 @@ from powerline.lib.monotonic import monotonic from tests import TestCase, SkipTest -INOTIFY_DIR = 'inotify' + os.environ.get('PYTHON', '') +INOTIFY_DIR = 'inotify' + os.path.basename(os.environ.get('PYTHON', '')) def clear_dir(dir):