-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from nbraud/tests/pypy3.6
Travis: Run tests under PyPy
- Loading branch information
Showing
2 changed files
with
68 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |