Skip to content

Commit 89df9fa

Browse files
authored
Merge pull request #106 from rhpvorderman/fix_coverage
fix coverage reporting on codacy
2 parents b607c80 + 518e317 commit 89df9fa

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,16 @@ commands = pytest {[tox]test_dir}
4141

4242
[testenv:py35-pytest]
4343
passenv = TRAVIS,CODACY_PROJECT_TOKEN
44+
whitelist_externals = sed
45+
bash
4446
commands =
4547
pytest --cov={envsitepackagesdir}/ephemeris --cov-report xml {[tox]test_dir}
46-
bash -c 'if [ "$TRAVIS" = "true" ] ; then python-codacy-coverage -r coverage.xml; fi'
48+
# Replace the installed package directory by the source directory.
49+
# This is needed for codacy to understand which files have coverage testing
50+
sed -i 's#{envsitepackagesdir}#src#' coverage.xml
51+
# If running on travis, send a coverage report to codacy.
52+
# The CODACY_PROJECT_TOKEN env variable should be defined on travis.
53+
bash -c 'if [ "$TRAVIS" = "true" ] ; then python-codacy-coverage -r coverage.xml; fi'
4754

4855
[testenv:py27]
4956
commands = bash {[tox]test_dir}/test.sh

0 commit comments

Comments
 (0)