Skip to content

Commit

Permalink
Merge pull request #105 from nbraud/tests/pypy3.6
Browse files Browse the repository at this point in the history
Travis: Run tests under PyPy
  • Loading branch information
AstraLuma authored Jan 18, 2019
2 parents f646fb3 + 3ca2f0a commit d45c897
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
47 changes: 47 additions & 0 deletions .ci/install-python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

# Nothing to do if no specific Python version is requested
[ -n "${PYTHON+x}" ] || return 0

function run() {
echo '$' "$@"
"$@" || exit 1
}

if [[ "$TRAVIS_OS_NAME" != linux ]]; then
echo "This script only supports linux, got \$TRAVIS_OS_NAME='${TRAVIS_OS_NAME}'" >&2
exit 1
fi

if [[ "$PYTHON" =~ pypy-* ]]; then
# Download & install a prebuilt pypy snapshot
PYPY_BRANCH=${PYTHON#*-}
URL="http://buildbot.pypy.org/nightly/${PYPY_BRANCH}/pypy-c-jit-latest-linux64.tar.bz2"
run wget "${URL}" -O ../pypy.tar.bz2
run tar -C .. -xf ../pypy.tar.bz2
pushd ..; PYPY=( pypy-c-jit-* ); popd

echo "Using ${PYPY}"
export PATH="$(realpath ../${PYPY}/bin):${PATH}"
echo "PATH='${PATH}'"

run ln -s pypy3 "../${PYPY}/bin/python"
run python -m ensurepip
run ln -s pip3 "../${PYPY}/bin/pip"
run pip install -U pip wheel

else
# Install a Python version with miniconda
MINICONDA_OS=Linux
URL="https://repo.continuum.io/miniconda/Miniconda3-latest-${MINICONDA_OS}-x86_64.sh"
run wget "${URL}" -O ../miniconda.sh
run bash ../miniconda.sh -b -p "$HOME/miniconda"
export PATH="$HOME/miniconda/bin:$PATH"
echo "PATH='${PATH}'"

run conda config --set always_yes yes --set changeps1 no
run conda update -q conda
run conda info -a
run conda create -q -n test-environment "python=$PYTHON"
run source activate test-environment
fi
36 changes: 21 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
addons:
apt:
packages:
- realpath

sudo: no
language: python
matrix:
fast_finish: yes
include:
# CPython builds
- os: linux
python: 3.6
- os: linux
language: generic
env: PYTHON="3.7" MINICONDA_OS="Linux"
env: PYTHON="3.7"
- os: linux
python: nightly

# PyPy builds
- os: linux
language: generic
env: PYTHON="pypy-py3.6"

allow_failures:
- python: "nightly"
- env: PYTHON="pypy-py3.6"

cache:
directories:
- $HOME/.cache/pip
- .hypothesis

before_install:
- if [[ $MINICONDA_OS ]]; then
URL="https://repo.continuum.io/miniconda/Miniconda3-latest-${MINICONDA_OS}-x86_64.sh";
wget "${URL}" -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
hash -r;
conda config --set always_yes yes --set changeps1 no;
conda update -q conda;
conda info -a;
conda create -q -n test-environment python=$PYTHON;
source activate test-environment;
fi;
- source ./.ci/install-python.sh

install:
- pip install -e .;
- # Do not install mypy during pypy builds
'[[ ! "$PYTHON" =~ pypy-* ]] || sed -i "/^mypy/d" dev-requirements.txt'
- pip install -r dev-requirements.txt;

script:
- pytest --hypothesis-profile ci
- mypy ppb_vector tests
- '[[ "$PYTHON" =~ pypy-* ]] || mypy ppb_vector tests'
- python -m doctest README.md

0 comments on commit d45c897

Please sign in to comment.