From 39a28ca7eb2ba7966677b5283bce1ebdf8974ee1 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Sun, 15 Sep 2019 23:55:11 +0200 Subject: Add coverage reporting to tests. --- .gitignore | 6 ++++++ Pipfile | 1 + azure-pipelines.yml | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index be4f43c7f..09ca151fb 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,9 @@ log.* # Custom user configuration config.yml + +# JUnit XML reports from pytest +junit.xml + +# Coverage XML artifacts +coverage.xml diff --git a/Pipfile b/Pipfile index eaef3bd65..273db04d2 100644 --- a/Pipfile +++ b/Pipfile @@ -32,6 +32,7 @@ pre-commit = "~=1.18" safety = "*" dodgy = "*" pytest = "*" +pytest-cov = "*" [requires] python_version = "3.7" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 19df35c11..242513ab4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,9 +38,23 @@ jobs: - script: python -m flake8 displayName: 'Run linter' - - script: BOT_TOKEN=foobar python -m pytest tests + - script: BOT_TOKEN=foobar python -m pytest --junitxml=junit.xml --cov=bot --cov-branch --cov-report=term --cov-report=xml tests displayName: Run tests + - task: PublishCodeCoverageResults@1 + displayName: 'Publish Coverage Results' + condition: succeededOrFailed() + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: coverage.xml + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFiles: junit.xml + testRunTitle: 'Bot Test results' + - job: build displayName: 'Build Containers' dependsOn: 'test' -- cgit v1.2.3