Hi @MaximilianGlas,
I noticed there wasn't a solution to your question. This is all possible in Azure DevOps services and will require significant setup/understanding of Azure Pipelines.
Firstly, some requirements. You will need:
- A machine with:
- An account with Administrative privileges,
- ArcGIS Pro installation with a Single use license allocated,
- A Self-hosted Windows agent installed to your DevOps organization or instance.
Before installing your Self-hosted Windows agent, you should clone the default CONDA environment of your ArcGIS Pro installation. It will allow us to install any additional packages (like pytest-cov & pytest-azurepipelines. We can call it arcgispro-azure-agent-env. We should also set this as an agent capability by adding it as a Windows Environment variable. System or locally is fine. We will call it ARC_AZ_ENV.
Run through the installation guide for Self-hosted Windows agent. Your Azure DevOps organization/instance should now have access to your machine via the Agent under an Agent Pool.
Assuming your tests are in the root path of your Azure Repo, we can setup a build pipeline which runs a job with your Agent. The job below will pip install pytest-cov and pytest-azurepipelines, run the pytests from the root and finally, publish the coverage results.
jobs:
- job: TestWebTool
pool:
name: MyAgentPool
demands:
- ARC_AZ_ENV
steps:
- checkout: self
- script: |
pip.exe install pytest-cov
pip.exe install pytest-azurepipelines
workingDirectory: "$(ARC_AZ_ENV)\Scripts"
- script: |
"$(ARC_AZ_ENV)\python.exe -m pytest --cov --cov-report xml:converage.xml
workingDirectory: $(Build.SourcesDirectory)
- task: PublishCodeCoverageResults@2
inputs:
summaryFileLocation:$(Build.SourcesDirectory)\coverage.xml
Azure Pipelines will automatically pickup your pytest results and publish them. Azure DevOps services have a number of formats and test suites which can be published. You can use the task: PublishTestResults@2. The tests and coverage results will appear in your build result like below.
Good luck!