Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Oct 1, 2018
1 parent 561dcb7 commit a1a1c0d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 19 deletions.
49 changes: 45 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- template: azure-run-tox-env.yml
parameters: {name: macOS_36, python: '3.6', image: 'macOS 10.13'}

- job: tests_done
- job: report_tests
pool: {vmImage: 'Ubuntu 16.04'}
condition: always()
dependsOn:
Expand All @@ -71,12 +71,53 @@ jobs:
- linux_27
- macOS_36
steps:
- script: curl -vk https://coveralls.io/webhook?repo_token=$(COVERALLS_REPO_TOKEN) -d "payload[build_num]=$(Build.BuildId)&payload[status]=done"
displayName: notify coveralls that we finished coverge reports
- task: UsePythonVersion@0
displayName: setup python for coverage
inputs:
versionSpec: '3.7'

- script: 'python -m pip install -U tox --pre'
displayName: install tox

- script: 'python -m tox -e coverage --notest'
displayName: create coverag report env

- task: DownloadBuildArtifacts@0
displayName: 'download coverage files'
inputs:
buildType: 'current'
downloadType: 'specific'
itemPattern: 'test-report-*'
downloadPath: '$(System.DefaultWorkingDirectory)/.tox'

- task: PublishTestResults@2
displayName: publish test results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(System.DefaultWorkingDirectory)/.tox/.tests.*.xml'

- script: 'python -m tox -e coverage'
displayName: create coverag report

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/.tox/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/.tox/htmlcov'
failIfCoverageEmpty: true

- script: 'python -m tox -e coveralls -- $(Build.BuildId) $(System.PullRequest.PullRequestNumber)'
displayName: upload coveralls
env:
CI_BRANCH: $(Build.SourceBranch)
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
COVERALLS_PARALLEL: false
COVERALLS_FLAG_NAME: ${{ parameters.name }}


- job: publish
dependsOn:
- tests_done
- report_tests
- check_code_style
- generate_docs
- check_package_long_description
Expand Down
17 changes: 8 additions & 9 deletions azure-run-tox-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ jobs:
displayName: perform tox env run
env:
TOXENV: ${{ parameters.tox }}
COVERAGE_FILE: ${{ format('$(Build.StagingDirectory)/.coverage.{0}', parameters.name) }}
JUNIT_XML_FILE: ${{ format('$(Build.StagingDirectory)/.test.{0}.xml', parameters.name) }}

- ${{ if eq(parameters.tox, 'py') }}:

- script: 'python -m tox -e coverage'
displayName: generate coverage report
- script: 'ls -alth $(Build.ArtifactStagingDirectory)'

- script: 'python -m tox -e coveralls -- $(Build.BuildId) $(System.PullRequest.PullRequestNumber)'
displayName: upload coveralls
env:
CI_BRANCH: $(Build.SourceBranch)
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN)
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ parameters.name }}
- task: PublishBuildArtifacts@1
displayName: publish tests data artifacts
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: ${{ format('test-report-{0}', parameters.name) }}
15 changes: 9 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ skip_missing_interpreters = true
[testenv]
description = run the tests with pytest under {basepython}
setenv = PIP_DISABLE_VERSION_CHECK = 1
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
deps =
extras = testing
commands = pytest {posargs:--cov="{envsitepackagesdir}/tox" --cov-config="{toxinidir}/tox.ini" --timeout=180 . -n {env:PYTEST_XDIST_PROC_NR:auto}}
commands = pytest {posargs:\
--cov="{envsitepackagesdir}/tox" \
--cov-config="{toxinidir}/tox.ini" \
--timeout=180 \
-n={env:PYTEST_XDIST_PROC_NR:auto} \
--junitxml={env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} \
. }


[testenv:docs]
description = invoke sphinx-build to build the HTML docs
Expand Down Expand Up @@ -103,16 +110,12 @@ branch = true
skip_covered = True
show_missing = True
exclude_lines =
# Have to re-enable the standard pragma
\#\s*pragma: no cover
# We optionally substitute this
${COVERAGE_IGNORE_WINDOWS}
# Don't complain if tests don't hit defensive assertion code:
^\s*raise AssertionError\b
^\s*raise NotImplementedError\b
^\s*return NotImplemented\b
^\s*raise$
# Don't complain if non-runnable code isn't run:
^if __name__ == ['"]__main__['"]:$
[coverage:paths]
Expand Down

0 comments on commit a1a1c0d

Please sign in to comment.