From 5eae3ece4d4cfddb3e72ac18bfc4059bdcc2f6bb Mon Sep 17 00:00:00 2001 From: alyssaq Date: Sat, 14 Jul 2018 11:09:36 -0500 Subject: [PATCH] codecov integration. scipy2018 sprint. --- .codecov.yml | 10 ++++++++++ .travis.yml | 2 +- README.md | 1 + tools/test-installed-numpy.py | 4 ++++ tools/travis-test.sh | 15 +++++++++++++-- 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000000..5e58905882dd --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,10 @@ +codecov: + ci: + - !appveyor +coverage: + status: + project: + default: + # Require 1% coverage, i.e., always succeed + target: 1 +comment: off diff --git a/.travis.yml b/.travis.yml index 6b010e58f6a2..e428953e03a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ matrix: - python3-dev - python3-setuptools - python: 3.6 - env: USE_WHEEL=1 RUN_FULL_TESTS=1 + env: USE_WHEEL=1 RUN_FULL_TESTS=1 RUN_COVERAGE=1 - python: 2.7 env: USE_WHEEL=1 RUN_FULL_TESTS=1 PYTHON_OPTS="-3 -OO" - python: 3.6 diff --git a/README.md b/README.md index acdf43c45ddf..605ecaf9571b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Travis](https://img.shields.io/travis/numpy/numpy/master.svg?label=Travis%20CI)](https://travis-ci.org/numpy/numpy) [![AppVeyor](https://img.shields.io/appveyor/ci/charris/numpy/master.svg?label=AppVeyor)](https://ci.appveyor.com/project/charris/numpy) +[![codecov](https://codecov.io/gh/numpy/numpy/branch/master/graph/badge.svg)](https://codecov.io/gh/numpy/numpy) NumPy is the fundamental package needed for scientific computing with Python. diff --git a/tools/test-installed-numpy.py b/tools/test-installed-numpy.py index 04a2a1da2183..14f11b7ed81a 100644 --- a/tools/test-installed-numpy.py +++ b/tools/test-installed-numpy.py @@ -46,6 +46,10 @@ print('NPY_RELAXED_STRIDES_CHECKING not set, but active.') sys.exit(1) +if options.coverage: + # Produce code coverage XML report for codecov.io + args += ["--cov-report=xml"] + result = numpy.test(options.mode, verbose=options.verbose, extra_argv=args, diff --git a/tools/travis-test.sh b/tools/travis-test.sh index b99866f0d810..11863b5febce 100755 --- a/tools/travis-test.sh +++ b/tools/travis-test.sh @@ -105,6 +105,11 @@ run_test() export PYTHONPATH=$PWD fi + if [ -n "$RUN_COVERAGE" ]; then + pip install pytest-cov + COVERAGE_FLAG=--coverage + fi + # We change directories to make sure that python won't find the copy # of numpy in the source directory. mkdir -p empty @@ -113,10 +118,17 @@ run_test() "import os; import numpy; print(os.path.dirname(numpy.__file__))") export PYTHONWARNINGS=default if [ -n "$RUN_FULL_TESTS" ]; then - $PYTHON ../tools/test-installed-numpy.py -v --mode=full + export PYTHONWARNINGS="ignore::DeprecationWarning:virtualenv" + $PYTHON ../tools/test-installed-numpy.py -v --mode=full $COVERAGE_FLAG else $PYTHON ../tools/test-installed-numpy.py -v fi + + if [ -n "$RUN_COVERAGE" ]; then + # Upload coverage files to codecov + bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy + fi + if [ -n "$USE_ASV" ]; then pushd ../benchmarks $PYTHON `which asv` machine --machine travis @@ -181,4 +193,3 @@ else setup_base run_test fi -