From c88e75251cd60be7e7adfff2263dba12196dfc3d Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez Date: Wed, 5 Nov 2014 21:01:10 -0600 Subject: [PATCH] Fix Travis failures --- .travis.yml | 8 +------- Makefile | 50 +++++++++++++++++++++++++++++++++++++++++++++-- tests/test_bin.py | 5 ++++- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0009569..9e51591 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,15 +8,9 @@ python: - "3.4" cache: - $HOME/.pip-cache -# command to install dependencies -install: - - pip install -r requirements-travis.txt --download-cache $HOME/.pip-cache - - pip install coveralls --download-cache $HOME/.pip-cache - - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi # needs for running tests - - pip install --allow-all-external -e . # command to run tests script: make travis -after_success: coveralls +after_success: make coveralls notifications: email: - paultag@gmail.com diff --git a/Makefile b/Makefile index e1f3ea9..374a48f 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,21 @@ +pypy_url=http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux64.tar.bz2 +pip_url=https://bootstrap.pypa.io/get-pip.py +python=python +pip=pip +coveralls=coveralls +nose=nosetests +pcache=$(HOME)/.pip-cache + +ifeq (PyPy 2.4,$(findstring PyPy 2.4,$(shell python -V 2>&1 | tail -1))) + bad_pypy=1 + python=./pypy + pip=./pip + coveralls=./coveralls + nose=./nosetests +else + bad_pypy= +endif + all: @echo "No default step. Use setup.py" @echo "" @@ -53,14 +71,42 @@ diff: r: d tox diff -travis: - nosetests -s --with-coverage --cover-package hy +python: +ifeq ($(bad_pypy),1) + # Due to stupid PyPy 2.4 bugs, a custom version needs to be downloaded + curl $(pypy_url) -o pypy.tbz2 + tar xf pypy.tbz2 + ln -sf `pwd`/pypy-*/bin/pypy $(python) + curl $(pip_url) | $(python) + ln -sf `pwd`/pypy-*/bin/pip $(pip) + sudo $(pip) install nose + ln -sf `pwd`/pypy-*/bin/nosetests $(nose) +endif +ifeq (Python 2.6,$(findstring Python 2.6,$(shell python -V 2>&1))) + $(pip) install unittest2 +endif + $(pip) install -r requirements-travis.txt --download-cache $(pcache) + $(pip) install coveralls --download-cache $(pcache) + $(pip) install --allow-all-external -e . +ifeq ($(bad_pypy),1) + ln -sf `pwd`/pypy-*/bin/coveralls $(coveralls) +endif + +travis: python +ifeq ($(bad_pypy),1) + HY_DIR=`pwd`/pypy-*/bin $(nose) -s --with-coverage --cover-package hy +else + $(nose) -s --with-coverage --cover-package hy +endif ifeq (PyPy,$(findstring PyPy,$(shell python -V 2>&1 | tail -1))) @echo "skipping flake8 on pypy" else flake8 hy bin tests endif +coveralls: + $(coveralls) + clean: @find . -name "*.pyc" -exec rm {} \; @find -name __pycache__ -delete diff --git a/tests/test_bin.py b/tests/test_bin.py index 16383e4..e8a0fc8 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -26,8 +26,11 @@ import subprocess from hy._compat import PY3 +hy_dir = os.environ.get('HY_DIR', '') + + def run_cmd(cmd, stdin_data=None): - p = subprocess.Popen(cmd, + p = subprocess.Popen(os.path.join(hy_dir, cmd), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,