Skip to content

Commit

Permalink
Get coverage/coveralls working in Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
marqh authored and djkirkham committed Sep 22, 2016
1 parent b2b46b1 commit f29e6c8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# .coveragerc to control coverage.py
#

[run]
branch = True
omit =
test*.py
setup.py


[report]
exclude_lines =
pragma: no cover
def __repr__
if __name__ == .__main__.:
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ sudo: false

env:
- TEST_TARGET=default
- TEST_TARGET=default COVERAGE=true
- TEST_TARGET=default TEST_MINIMAL=true
- TEST_TARGET=coding
- TEST_TARGET=example
Expand Down Expand Up @@ -59,6 +60,7 @@ install:
conda install --quiet --file conda-requirements.txt;
fi
fi
- pip install coveralls

- PREFIX=$HOME/miniconda/envs/$ENV_NAME

Expand Down Expand Up @@ -101,11 +103,18 @@ install:

# iris
- python setup.py --quiet --with-unpack build
- python setup.py --quiet --with-unpack install
- python setup.py --quiet --with-unpack install --user

script:
- if [[ $TEST_TARGET == 'default' ]]; then
python -m iris.tests.runner --default-tests --system-tests --print-failed-images;
if [[ $COVERAGE == true ]]; then
SITECUSTOMIZE=$PREFIX/lib/python$TRAVIS_PYTHON_VERSION/site-packages/sitecustomize.py;
echo 'import coverage; coverage.process_startup()' > "$SITECUSTOMIZE";
export COVERAGE_PROCESS_START="$PWD/.coveragerc";
coverage run --concurrency=multiprocessing -pm iris.tests.runner --default-tests --system-tests --print-failed-images;
else
python -m iris.tests.runner --default-tests --system-tests --print-failed-images;
fi
fi
- if [[ $TEST_TARGET == 'example' ]]; then
python -m iris.tests.runner --example-tests --print-failed-images;
Expand All @@ -128,3 +137,8 @@ script:
- if [[ $TEST_TARGET == 'coding' ]]; then
python setup.py test --coding-tests;
fi
after_success:
- if [[ $COVERAGE == true ]]; then
coverage combine;
coveralls;
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Iris

[![Build Status](https://api.travis-ci.org/repositories/SciTools/iris.svg?branch=master)](http://travis-ci.org/SciTools/iris/branches)
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.51860.svg)](http://dx.doi.org/10.5281/zenodo.51860)
[![Coverage Status](https://coveralls.io/repos/github/SciTools/iris/badge.svg?branch=master)](https://coveralls.io/github/SciTools/iris?branch=master)

(C) British Crown Copyright 2010 - 2015, Met Office

Expand Down
2 changes: 1 addition & 1 deletion conda-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ netcdf4
numpy
pyke
udunits2
cf_units
cf_units<1.1.1

# Iris build dependencies
setuptools
Expand Down

0 comments on commit f29e6c8

Please sign in to comment.