Azure / Azure/pytest-azurepipelines

Failed to inline CSS styles in coverage reports

Open
#90 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
124
Forks
44
PR merge metrics
No merged PRs in 30d

Description

I want to run pytests on a docker container by means of Azure Pipelines.

Given this pipeline snippet:
``` yaml
- job: Test
dependsOn: Build
steps:
- checkout: none
- task: Bash@3
inputs:
targetType: 'inline'
script: |
mkdir $(Build.SourcesDirectory)/reports
chmod 777 $(Build.SourcesDirectory)/reports
displayName: 'Prepare mount folder for reports'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
docker run --rm -v $(Build.SourcesDirectory)/reports:/app/myapp/reports $(image_tag) \
/bin/bash -c 'pytest . --nunit-xml=reports/test-results.xml --cov --cov-report=xml:reports/coverage.xml --cov-report=html:reports/coverage_html --report-dir=reports/coverage_html'
displayName: 'Run PyTest'
```

I get this warning during build:
`##[warning]Failed to inline CSS styles in coverage reports. Error: [Errno 2] No such file or directory: '/home/foo/myagent/_work/3/s/reports/coverage_html'`

The full output is
``` bash

/usr/bin/bash /home/foo/myagent/_work/_temp/4c87c14f-c7ef-42aa-84fd-cd74437fb01a.sh
============================= test session starts ==============================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
rootdir: /app/myapp
plugins: azurepipelines-1.0.5, cov-4.1.0, nunit-1.0.4, anyio-3.7.1
collected 4 items

app/test_main.py . [ 25%]
Result Attachments will be stored in LogStore
Run Attachments will be stored in LogStore
##[warning]Failed to inline CSS styles in coverage reports. Error: [Errno 2] No such file or directory: '/home/foo/myagent/_work/3/s/reports/coverage_html'
Reading code coverage summary from '/home/foo/myagent/_work/3/s/reports/coverage.xml'

-- generated Nunit xml file: /app/myapp/reports/test-results.xml ---

---------- coverage: platform linux, python 3.10.13-final-0 ----------
Coverage HTML written to dir reports/coverage_html
Coverage XML written to file reports/coverage.xml

============================== 4 passed in 1.94s ===============================
Async Command Start: Publish test results
Publishing test results to test run '394084'.
TestResults To Publish 4, Test run id:394084
Test results publishing 4, remaining: 0. Test run id: 394084
Published Test Run : https://dev.azure.com/SW4ZF/AZP-352_DivDI_EcoRouting/_TestManagement/Runs?runId=394084&_a=runCharts
Async Command End: Publish test results
Async Command Start: Publish code coverage
Publishing coverage summary data to TFS server.
Lines- 93 of 164 covered.
Branches- 0 of 0 covered.
Modifying Cobertura Index file
Publishing code coverage files to TFS server.
Uploading 18 files
File upload succeed.
Published '/home/infra-admin/myagent/_work/3/s/reports/coverage_html' as artifact 'Code Coverage Report_503679'
Async Command End: Publish code coverage
Finishing: Run PyTest
```

Due to missing inlining of css, the coverage report is broken in AzureDevOps:
![image](https://github.com/Azure/pytest-azurepipelines/assets/7727144/87ab0928-8f84-4d89-ade1-4d2d7549adf7)

I've tried for hours, but can't find a way to fix this warning.

Any help is highly appreciated. Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.