Skip to content

Commit

Permalink
Try this WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
aragilar committed Oct 6, 2019
1 parent 341aa09 commit af63121
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
6 changes: 2 additions & 4 deletions ci/azure-pipelines-steps.yml
Expand Up @@ -69,11 +69,9 @@ steps:

- script: |
tox
ls -a .coverage_dir
displayName: 'tox'

- script: |
pwd
ls -a
codecov --required -t 813fb6da-087d-4b36-a185-5a530cab3455 --file coverage.xml
python3 ci/fix_coverage.py
codecov --required -t 813fb6da-087d-4b36-a185-5a530cab3455
displayName: 'codecov'
27 changes: 27 additions & 0 deletions ci/fix_coverage.py
@@ -0,0 +1,27 @@
"""
Helper script to combine coverage (as codecov seems to have problems...).
Written in python to be cross-plotform
"""

from os import chdir, listdir
from pathlib import Path
from pprint import pprint
from subprocess import run

THIS_FILE = Path(__file__)
GIT_MAIN_DIR = THIS_FILE.parent.parent.resolve()
COVERAGE_DIR = GIT_MAIN_DIR.joinpath('.coverage_dir')

def main():
chdir(GIT_MAIN_DIR)
print(f"Working in {GIT_MAIN_DIR}, listing coverage dir {COVERAGE_DIR}")
pprint(listdir(COVERAGE_DIR))
run(['coverage', 'combine'] + COVERAGE_DIR.glob('coverage-*'), check=True)
print(f"Combined coverage, listing {GIT_MAIN_DIR}")
pprint(listdir(GIT_MAIN_DIR))
run(['coverage', 'xml'], check=True)
print(f"Created coverage xml, listing {GIT_MAIN_DIR}")
pprint(listdir(GIT_MAIN_DIR))

if __name__ == '__main__':
main()
3 changes: 1 addition & 2 deletions tox.ini
Expand Up @@ -30,13 +30,12 @@ commands =
test: python -c "import sys; print('64 bit?', sys.maxsize > 2**32)"
test: python {toxinidir}/ci/fix_paths.py
test: python -m pytest --pyargs h5py --cov=h5py --cov-config={toxinidir}/.coveragerc {posargs}
test: python -m coverage xml -i '{toxinidir}/.coverage_dir/coverage*' -o {toxinidir}/coverage.xml
changedir =
test: {toxworkdir}
passenv =
HDF5_DIR
setenv =
COVERAGE_FILE={toxinidir}/.coverage_dir/coverage
COVERAGE_FILE={toxinidir}/.coverage_dir/coverage-{envname}
# needed otherwise coverage cannot find the file when reporting

pip_pre =
Expand Down

0 comments on commit af63121

Please sign in to comment.