diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 881f7dc22..949c39fc4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) diff --git a/scripts/setup-coverage-vars.bat b/scripts/setup-coverage-vars.bat new file mode 100644 index 000000000..7a4a6d4de --- /dev/null +++ b/scripts/setup-coverage-vars.bat @@ -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% +) diff --git a/scripts/upload-coverage.bat b/scripts/upload-coverage.bat index b51d4060f..2e84f99dd 100644 --- a/scripts/upload-coverage.bat +++ b/scripts/upload-coverage.bat @@ -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% )