Fix error messages in test coverage reporting (#394)

- Coverage reporting complains that it does not like the HTML output folder.
- Exclude the Tests* folders from the report, so that the overall coverage figures make more sense
This commit is contained in:
Anton Schwaighofer 2021-02-10 14:29:20 +00:00 коммит произвёл GitHub
Родитель 7ef6ff9ecc
Коммит eb5f931f20
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 11 добавлений и 22 удалений

5
.coveragerc Normal file
Просмотреть файл

@ -0,0 +1,5 @@
[run]
omit =
Tests/*
TestsOutsidePackage/*
TestSubmodule/*

Просмотреть файл

@ -1,19 +0,0 @@
#!/usr/bin/env bash
# Assumes all tests if no argument was given
# cpu: test everything that does need a gpu
# gpu: test everything that needs a gpu
# all: run all tests
if [[ $# -eq 0 ]]
then
folder=../tests
echo running all tests
else
echo unknown arg, exiting
exit -1
fi
cd ../ML
python -m pytest -v -s --cov-report term-missing --cov=. ${folder}

Просмотреть файл

@ -12,6 +12,9 @@ variables:
tag: '' tag: ''
number_of_cross_validation_splits: 0 number_of_cross_validation_splits: 0
cluster: 'training-nc12' cluster: 'training-nc12'
# Disable a spurious warning
# https://stackoverflow.com/questions/56859264/publishing-code-coverage-results-from-reportgenerator-not-working
disable.coverage.autogenerate: 'true'
jobs: jobs:
- job: Windows - job: Windows

Просмотреть файл

@ -74,7 +74,7 @@ steps:
# hence don't set PYTHONPATH # hence don't set PYTHONPATH
- bash: | - bash: |
source activate InnerEye source activate InnerEye
pytest ./Tests/ -m "not gpu and not azureml and not after_training_single_run and not after_training_ensemble_run and not inference and not after_training_2node" --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html -n 2 --dist=loadscope --verbose pytest ./Tests/ -m "not (gpu or azureml or after_training_single_run or after_training_ensemble_run or inference or after_training_2node)" --doctest-modules --junitxml=junit/test-results.xml --cov=. --cov-config=.coveragerc --cov-report=xml -n 2 --dist=loadscope --verbose
env: env:
APPLICATION_KEY: $(InnerEyeDeepLearningServicePrincipalKey) APPLICATION_KEY: $(InnerEyeDeepLearningServicePrincipalKey)
DATASETS_ACCOUNT_KEY: $(InnerEyePublicDatasetsStorageKey) DATASETS_ACCOUNT_KEY: $(InnerEyePublicDatasetsStorageKey)
@ -103,8 +103,8 @@ steps:
- task: PublishCodeCoverageResults@1 - task: PublishCodeCoverageResults@1
inputs: inputs:
codeCoverageTool: Cobertura codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml' summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov' reportDirectory: '$(System.DefaultWorkingDirectory)/htmlcov'
condition: succeededOrFailed() condition: succeededOrFailed()
- task: ComponentGovernanceComponentDetection@0 - task: ComponentGovernanceComponentDetection@0