Commit 59e72c65 authored by Kyle Stewart's avatar Kyle Stewart
Browse files

Add travis tests for PyPy.

Aliased PYTHON_VERSION to MB_PYTHON_VERSION.

Changed the test command to use get_python_enviroment instead of
get_macpython_enviroment.

Extended TravisCI matrix to cover PyPy.
The tests can now tell the implementation of PyPy apart from the CPython
version they emulate.
parent 618a1d61
...@@ -29,6 +29,38 @@ matrix: ...@@ -29,6 +29,38 @@ matrix:
env: env:
- PYTHON_VERSION=3.6.0 - PYTHON_VERSION=3.6.0
- VENV=venv - VENV=venv
- os: osx
env:
- PYPY_VERSION=2.6
- VENV=venv
- os: osx
env:
- PYPY_VERSION=4.0
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.0
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.1
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.3
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.4
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.6
- VENV=venv
- os: osx
env:
- PYPY_VERSION=5.7
- VENV=venv
script: script:
- source tests/test_multibuild.sh - source tests/test_multibuild.sh
...@@ -124,8 +124,8 @@ function install_python { ...@@ -124,8 +124,8 @@ function install_python {
# Picks an implementation of Python determined by the current enviroment # Picks an implementation of Python determined by the current enviroment
# variables, then installs it # variables, then installs it
# A sub-function will set $PYTHON_EXE variable to the python executable # A sub-function will set $PYTHON_EXE variable to the python executable
if [ -n "$MB_PYTHON_VERSION" ]; then if [ -n ${MB_PYTHON_VERSION:-"$PYTHON_VERSION"} ]; then
install_macpython $MB_PYTHON_VERSION install_macpython ${MB_PYTHON_VERSION:-"$PYTHON_VERSION"}
elif [ -n "$PYPY_VERSION" ]; then elif [ -n "$PYPY_VERSION" ]; then
install_mac_pypy $PYPY_VERSION install_mac_pypy $PYPY_VERSION
else else
......
...@@ -6,7 +6,7 @@ source tests/test_common_utils.sh ...@@ -6,7 +6,7 @@ source tests/test_common_utils.sh
source tests/test_fill_submodule.sh source tests/test_fill_submodule.sh
if [ -n "$IS_OSX" ]; then if [ -n "$IS_OSX" ]; then
source osx_utils.sh source osx_utils.sh
get_macpython_environment $PYTHON_VERSION $VENV get_python_environment $VENV
source tests/test_python_install.sh source tests/test_python_install.sh
source tests/test_fill_pyver.sh source tests/test_fill_pyver.sh
source tests/test_osx_utils.sh source tests/test_osx_utils.sh
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
[ "$(pyinst_ext_for_version 3)" == pkg ] || ingest [ "$(pyinst_ext_for_version 3)" == pkg ] || ingest
# Test utilities for getting Python version versions # Test utilities for getting Python version versions
[ "$(get_py_digit)" == "${PYTHON_VERSION:0:1}" ] || ingest [ "$(get_py_digit)" == "${cpython_version:0:1}" ] || ingest
[ "$(get_py_mm)" == "${PYTHON_VERSION:0:3}" ] || ingest [ "$(get_py_mm)" == "${cpython_version:0:3}" ] || ingest
[ "$(get_py_mm_nodot)" == $(echo "${PYTHON_VERSION:0:3}" | tr -d .) ] || \ [ "$(get_py_mm_nodot)" == $(echo "${cpython_version:0:3}" | tr -d .) ] || \
ingest ingest
...@@ -11,16 +11,29 @@ pip install delocate ...@@ -11,16 +11,29 @@ pip install delocate
delocate-listdeps --version || ingest "Delocate not installed right" delocate-listdeps --version || ingest "Delocate not installed right"
# Python version from Python to compare against required # Python version from Python to compare against required
python_version=$($PYTHON_EXE --version 2>&1 | awk '{print $2}') if [[ $($PYTHON_EXE --version 2>&1 | awk '{print $2}') =~ ([0-9.]*).?([0-9.]*) ]]
python_mm="${PYTHON_VERSION:0:1}.${PYTHON_VERSION:2:1}" then
# CPython version, 2.7.x on both CPython 2.7 and PyPy 5.4
cpython_version=${BASH_REMATCH[1]}
# CPython/PyPy version
implementer_version=${BASH_REMATCH[2]:-$cpython_version}
fi
python_mm="${cpython_version:0:1}.${cpython_version:2:1}"
requested_version=${PYTHON_VERSION:-${MB_PYTHON_VERSION:-${PYPY_VERSION:-${PYPY3_VERSION}}}}
# remove any version tags which my have been added to the enviroment variable
if [[ "$requested_version" =~ [^-]* ]]; then
requested_version="$BASH_REMATCH"
fi
if [ "$python_version" != $PYTHON_VERSION ]; then # simple regex match, a 2.7 pattern will match 2.7.11, but not 2
ingest "Wrong macpython python version $python_version" if ! [[ "$implementer_version" =~ $requested_version ]]; then
ingest "Wrong python version: $implementer_version"
fi fi
if [ -n "$VENV" ]; then # in virtualenv if [ -n "$VENV" ]; then # in virtualenv
# Correct pip and Python versions should be on PATH # Correct pip and Python versions should be on PATH
if [ "$($PYTHON_EXE --version)" != "$(python --version)" ]; then if [ "$($PYTHON_EXE --version 2>&1)" != "$(python --version 2>&1)" ]; then
ingest "Python versions do not match" ingest "Python versions do not match"
fi fi
if [ "$($PIP_CMD --version)" != "$(pip --version)" ]; then if [ "$($PIP_CMD --version)" != "$(pip --version)" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment