From d187a7ea441d0dd61f2474b36c1e09a5fa77dc32 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 00:15:07 +0100 Subject: [PATCH 1/6] .coveragerc: add configuration file for coverage.py --- .coveragerc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..4457d6ecb --- /dev/null +++ b/.coveragerc @@ -0,0 +1,28 @@ +[run] +# measure 'branch' coverage in addition to 'statement' coverage +# See: http://coverage.readthedocs.org/en/coverage-4.0.3/branch.html#branch +branch = True + +# list of directories to measure +source = + Lib/fontTools + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # keywords to use in inline comments to skip coverage + pragma: no cover + + # don't complain if tests don't hit defensive assertion code + raise AssertionError + raise NotImplementedError + + # don't complain if non-runnable code isn't run + if 0: + if __name__ == .__main__.: + +# ignore source code that can’t be found +ignore_errors = True + +# when running a summary report, show missing lines +show_missing = True From a37dc9f18641c140079f64137ecded244fb66b83 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 00:18:27 +0100 Subject: [PATCH 2/6] tox.ini: use {envpython} substituion for path to the virtual Python interpreter --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index a85a435f9..727848130 100644 --- a/tox.ini +++ b/tox.ini @@ -12,11 +12,11 @@ deps = pytest -rrequirements.txt install_command = - python -m pip install -v {opts} {packages} + {envpython} -m pip install -v {opts} {packages} commands = # check that we have the expected Python version and architecture - python -c "import sys; print(sys.version)" - python -c "import struct; print(struct.calcsize('P') * 8)" + {envpython} -c "import sys; print(sys.version)" + {envpython} -c "import struct; print(struct.calcsize('P') * 8)" # run the test suite py.test From 624fe3f6253411c02d10e35c183fb4543fc86a0f Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 00:17:14 +0100 Subject: [PATCH 3/6] tox.ini: configure coveralls --- tox.ini | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tox.ini b/tox.ini index 727848130..ad60b9995 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,20 @@ commands = # 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 + coveralls + [pytest] minversion = 2.8 testpaths = From 215ab5bec37b77db2277287aafafeb49a397c51a Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 01:07:56 +0100 Subject: [PATCH 4/6] travis.yml: add 'coveralls' tox environment to the matrix (use py35 on Linux) --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 43db37c26..186ff3d1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,9 @@ matrix: - 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: - ./.travis/install.sh From 573cf4c26680e95d347ddd635baca5d26e08fa12 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 01:51:12 +0100 Subject: [PATCH 5/6] travis/install.sh: don't use brew to install pyenv on OS X as it's too slow; just clone from git like in Linux --- .travis/install.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index 1929e961c..bd711e1f4 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -4,16 +4,15 @@ set -e set -x if [[ "$(uname -s)" == 'Darwin' ]]; then - brew update || brew update - (brew list | grep -q 'pyenv') || brew install pyenv - brew outdated pyenv || brew upgrade pyenv - - if which -s pyenv; then - eval "$(pyenv init -)" - fi + # 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 ;; @@ -26,8 +25,8 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then pyenv global 3.4.3 ;; py35) - pyenv install 3.5.0 - pyenv global 3.5.0 + pyenv install 3.5.1 + pyenv global 3.5.1 ;; pypy) pyenv install pypy-5.0.0 @@ -35,9 +34,9 @@ if [[ "$(uname -s)" == 'Darwin' ]]; then ;; esac pyenv rehash - python -m pip install --user virtualenv + python -m pip install --user --upgrade pip virtualenv else - # install pyenv to get latest pypy + # 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" @@ -45,10 +44,12 @@ else eval "$(pyenv init -)" pyenv install pypy-5.0.0 pyenv global pypy-5.0.0 + pyenv rehash fi - pip install virtualenv + 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 From 893d5d795a631e1f93dbd2eb56e31351c62b4b92 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 11 Apr 2016 01:52:49 +0100 Subject: [PATCH 6/6] travis/run.sh: simplify --- .travis/run.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.travis/run.sh b/.travis/run.sh index 42d0378ea..2a6562743 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -3,14 +3,11 @@ set -e set -x -if [[ "$(uname -s)" == "Darwin" ]]; then +if [[ "$(uname -s)" == "Darwin" || "${TOXENV}" == "pypy" ]]; then + PYENV_ROOT="$HOME/.pyenv" + PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" -else - if [[ "${TOXENV}" == "pypy" ]]; then - PYENV_ROOT="$HOME/.pyenv" - PATH="$PYENV_ROOT/bin:$PATH" - eval "$(pyenv init -)" - fi fi + source ~/.venv/bin/activate tox