Skip to content

Commit

Permalink
travis: use tox and .travis/ scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
moyogo committed May 18, 2016
1 parent af92aeb commit 7d73f8b
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 28 deletions.
18 changes: 17 additions & 1 deletion .gitignore
@@ -1 +1,17 @@
*.pyc
# Byte-compiled and optimized files
__pycache__/
*.py[co]
*$py.class

# Packaging
*.egg-info
MANIFEST

# Unit test and coverage files
.cache
.coverage
.coverage.*
.tox

# OS X Finder
.DS_Store
60 changes: 34 additions & 26 deletions .travis.yml
@@ -1,29 +1,37 @@
sudo: false
language: python
sudo: required
python:
- "2.6"
- "2.7"
- "3.4"
- "3.5"
before_install:
- git clone https://github.com/typesupply/defcon.git --branch ufo3
- git clone https://github.com/robofab-developers/robofab.git --branch ufo3k
- git clone https://github.com/behdad/fonttools.git
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: pypy
env: TOXENV=pypy
- language: generic
os: osx
# the default 'osx' on Travis is 10.9 Mavericks, with Python 2.7.5
env: TOXENV=py27
- language: generic
os: osx
# this is to test on 10.11 El Capitan which comes with Python 2.7.10
osx_image: xcode7.3
env: TOXENV=py27
- language: generic
os: osx
env: TOXENV=py34
- language: generic
os: osx
env: TOXENV=py35
- language: generic
os: osx
env: TOXENV=pypy
# coveralls is not listed in tox's envlist, but should run in travis
- python: 3.5
env: TOXENV=coveralls
install:
- cd defcon; python setup.py install; cd ..
- cd robofab; python setup.py install; cd ..
- cd fonttools; python setup.py install; cd ..
# fontMath
- python setup.py install
- pip install coveralls
- ./.travis/install.sh
script:
- cd Lib/fontMath
- coverage run --parallel-mode mathFunctions.py
- coverage run --parallel-mode --source=mathGlyph.py mathGlyph.py
- coverage run --parallel-mode mathGuideline.py
- coverage run --parallel-mode --source=mathInfo.py mathInfo.py
- coverage run --parallel-mode --source=mathKerning.py mathKerning.py
- coverage run --source=mathTransform.py mathTransform.py
after_success:
- coverage combine
- coveralls
- ./.travis/run.sh
54 changes: 54 additions & 0 deletions .travis/install.sh
@@ -0,0 +1,54 @@
#!/bin/bash

set -e
set -x

if [[ "$(uname -s)" == 'Darwin' ]]; then
# install pyenv from the git repo (quicker than using brew)
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

case "${TOXENV}" in
py27)
# install pip on the system python
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
;;
py34)
pyenv install 3.4.3
pyenv global 3.4.3
;;
py35)
pyenv install 3.5.1
pyenv global 3.5.1
;;
pypy)
pyenv install pypy-5.0.0
pyenv global pypy-5.0.0
;;
esac
pyenv rehash
python -m pip install --user --upgrade pip virtualenv
else
# on Linux, we only need pyenv to get the latest pypy
if [[ "${TOXENV}" == "pypy" ]]; then
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

if [[ "${TOXENV}" == "pypy" ]]; then
pyenv install pypy-5.0.0
pyenv global pypy-5.0.0
fi
pyenv rehash
fi
pip install --upgrade pip virtualenv
fi

# activate virtualenv and install test requirements
python -m virtualenv ~/.venv
source ~/.venv/bin/activate
pip install -r dev-requirements.txt
13 changes: 13 additions & 0 deletions .travis/run.sh
@@ -0,0 +1,13 @@
#!/bin/bash

set -e
set -x

if [[ "$(uname -s)" == "Darwin" || "${TOXENV}" == "pypy" ]]; then
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi

source ~/.venv/bin/activate
tox
3 changes: 3 additions & 0 deletions dev-requirements.txt
@@ -0,0 +1,3 @@
pytest>=2.8
virtualenv>=15.0
tox>=2.3
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -18,5 +18,6 @@
url="http://code.typesupply.com",
license="MIT",
packages=["fontMath"],
package_dir={"":"Lib"}
package_dir={"": "Lib"},
test_suite="fontMath"
)
50 changes: 50 additions & 0 deletions tox.ini
@@ -0,0 +1,50 @@
[tox]
#envlist = py27, pypy, py34, py35
envlist = py27, pypy, py34, py35

[testenv]
basepython =
py27: {env:TOXPYTHON:python2.7}
pypy: {env:TOXPYTHON:pypy}
py34: {env:TOXPYTHON:python3.4}
py35: {env:TOXPYTHON:python3.5}
deps =
pytest
-rrequirements.txt
install_command =
{envpython} -m pip install -v {opts} {packages}
commands =
# check that we have the expected Python version and architecture
{envpython} -c "import sys; print(sys.version)"
{envpython} -c "import struct; print(struct.calcsize('P') * 8)"
{envpython} -c "import ufoLib; print(ufoLib.__file__)"
# run the test suite
py.test

[testenv:coveralls]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
basepython=python3.5
deps =
{[testenv]deps}
pytest-cov
coveralls
skip_install = true
ignore_outcome = true
commands=
# measure test coverage and upload report to coveralls
py.test --cov=Lib/fontMath
coveralls

[pytest]
minversion = 2.8
testpaths =
Lib/fontMath
python_files =
test_*.py
python_classes =
*Test
addopts =
# run py.test in verbose mode
-v
# show extra test summary info
-r a

0 comments on commit 7d73f8b

Please sign in to comment.