Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add code coverage reports #1422

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage:
precision: 2
round: down
range: "30...100"
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[run]
data_file = coverage/.coverage
source = aiida
omit = *test*,*/migrations/*

Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.pyc
*~
*.swp
*.project
*.pydevproject
.settings
Expand All @@ -14,6 +15,5 @@
*.egg-info
.eggs

# files created by coverage
*\,cover
coverage/
# produced by coverage.py
.coverage
1 change: 1 addition & 0 deletions .travis-data/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import subprocess
import sys
import time

from aiida.common.exceptions import NotExistent
from aiida.orm import DataFactory
from aiida.orm.data.base import Int
Expand Down
18 changes: 11 additions & 7 deletions .travis-data/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ case "$TEST_TYPE" in
SPHINXOPTS="-nW" make -C docs
;;
tests)
DATA_DIR=${TRAVIS_BUILD_DIR}/.travis-data
# Add the .travis-data folder to the python path such that defined workchains can be found by the daemon
export PYTHONPATH=${PYTHONPATH}:${TRAVIS_BUILD_DIR}/.travis-data
export PYTHONPATH=${PYTHONPATH}:${DATA_DIR}

# Run the AiiDA tests
python ${TRAVIS_BUILD_DIR}/.travis-data/test_setup.py
python ${TRAVIS_BUILD_DIR}/.travis-data/test_fixtures.py
python ${TRAVIS_BUILD_DIR}/.travis-data/test_plugin_testcase.py
# Run preliminary tests
coverage run -a ${DATA_DIR}/test_setup.py
coverage run -a ${DATA_DIR}/test_fixtures.py
coverage run -a ${DATA_DIR}/test_plugin_testcase.py

verdi -p test_$TEST_AIIDA_BACKEND devel tests
# Run verdi devel tests
VERDI=`which verdi`
coverage run -a $VERDI -p test_${TEST_AIIDA_BACKEND} devel tests

# Run the daemon tests using docker
verdi -p $TEST_AIIDA_BACKEND run ${TRAVIS_BUILD_DIR}/.travis-data/test_daemon.py
# Note: This is not a typo, the profile is called ${TEST_AIIDA_BACKEND}
coverage run -a $VERDI -p ${TEST_AIIDA_BACKEND} run ${DATA_DIR}/test_daemon.py
;;
pre-commit)
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@ before_script:

script: .travis-data/test_script.sh

after_success:
# upload coverage report to codecov.io
- if [ "$TEST_TYPE" == "tests" ]; then codecov; fi

git:
depth: 3
2 changes: 2 additions & 0 deletions coverage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# created by coverage
html/
2 changes: 2 additions & 0 deletions docs/requirements_for_rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ chainmap
click-plugins
click-spinner
click==6.7
codecov
coverage==4.5.1
django-extensions==1.5.0
django==1.7.11
docutils==0.13.1
Expand Down
4 changes: 3 additions & 1 deletion setup_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@
'testing': [
'mock==2.0.0',
'pgtest==1.1.0',
'sqlalchemy-diff==0.1.3'
'sqlalchemy-diff==0.1.3',
'coverage==4.5.1',
'codecov'
],
'dev_precommit': [
'pre-commit==1.3.0',
Expand Down