Configure azure to enable coverage on PYTEST_COVERAGE=1, similar to Travis

This commit is contained in:
Bruno Oliveira 2019-02-26 19:22:23 -03:00
parent 6bd77c0abd
commit cd9415baf2
3 changed files with 25 additions and 9 deletions

View File

@ -8,8 +8,7 @@ variables:
python.exe: "python"
COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
_PYTEST_TOX_COVERAGE_RUN: "coverage run -m"
_PYTEST_TOX_EXTRA_DEP: "coverage-enable-subprocess"
PYTEST_COVERAGE: '0'
jobs:
@ -21,16 +20,20 @@ jobs:
py27:
python.version: '2.7'
tox.env: 'py27'
PYTEST_COVERAGE: '1'
py27-xdist:
python.version: '2.7'
tox.env: 'py27-xdist'
PYTEST_COVERAGE: '1'
py27-numpy/nobyte:
python.version: '2.7'
tox.env: 'py27-numpy,py27-nobyte'
PYTEST_COVERAGE: '1'
py27-trial:
python.version: '2.7'
tox.env: 'py27-trial'
python.needs_vc: True
PYTEST_COVERAGE: '1'
py27-pluggymaster-xdist:
python.version: '2.7'
tox.env: 'py27-pluggymaster-xdist'
@ -38,30 +41,33 @@ jobs:
python.version: 'pypy'
tox.env: 'pypy'
python.exe: 'pypy'
_PYTEST_TOX_COVERAGE_RUN: ""
_PYTEST_TOX_EXTRA_DEP: ""
PYTEST_NO_COVERAGE: "1"
py34:
python.version: '3.4'
tox.env: 'py34'
PYTEST_COVERAGE: '1'
py35:
python.version: '3.5'
tox.env: 'py35'
PYTEST_COVERAGE: '1'
py36:
python.version: '3.6'
tox.env: 'py36'
PYTEST_COVERAGE: '1'
py37:
python.version: '3.7'
tox.env: 'py37'
PYTEST_COVERAGE: '1'
py37-linting/docs/doctesting:
python.version: '3.7'
tox.env: 'linting,docs,doctesting'
py37-xdist:
python.version: '3.7'
tox.env: 'py37-xdist'
PYTEST_COVERAGE: '1'
py37-trial/numpy:
python.version: '3.7'
tox.env: 'py37-trial,py37-numpy'
PYTEST_COVERAGE: '1'
py37-pluggymaster-xdist:
python.version: '3.7'
tox.env: 'py37-pluggymaster-xdist'
@ -98,7 +104,9 @@ jobs:
- script: $(python.exe) -m pip install --upgrade pip && $(python.exe) -m pip install tox
displayName: 'Install tox'
- script: $(python.exe) -m tox -e $(tox.env)
- script: |
call scripts/setup-coverage-vars.bat || goto :eof
$(python.exe) -m tox -e $(tox.env)
displayName: 'Run tests'
- task: PublishTestResults@2
@ -109,5 +117,6 @@ jobs:
- script: call scripts\upload-coverage.bat
displayName: 'Upload coverage'
condition: eq(variables['PYTEST_COVERAGE'], '1')
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)

View File

@ -0,0 +1,7 @@
if "%PYTEST_COVERAGE%" == "1" (
set "_PYTEST_TOX_COVERAGE_RUN=coverage run -m"
set "_PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess"
echo Coverage vars configured, PYTEST_COVERAGE=%PYTEST_COVERAGE%
) else (
echo Skipping coverage vars setup, PYTEST_COVERAGE=%PYTEST_COVERAGE%
)

View File

@ -1,5 +1,5 @@
REM script called by AppVeyor to combine and upload coverage information to codecov
if not defined PYTEST_NO_COVERAGE (
REM script called by Azure to combine and upload coverage information to codecov
if "%PYTEST_COVERAGE%" == "1" (
echo Prepare to upload coverage information
if defined CODECOV_TOKEN (
echo CODECOV_TOKEN defined
@ -12,5 +12,5 @@ if not defined PYTEST_NO_COVERAGE (
coverage report -m --ignore-errors
scripts\retry codecov --required -X gcov pycov search -f coverage.xml --flags windows
) else (
echo Skipping coverage upload, PYTEST_NO_COVERAGE is set
echo Skipping coverage upload, PYTEST_COVERAGE=%PYTEST_COVERAGE%
)