Hi
I would like to set up test coverage integration. I have tried to follow the documentation at Test coverage visualization | GitLab I am running on gitlab.com
Inside the CI I run the tests similar to this:
test-stage:
.....
script:
.....
- docker run --name $CONTAINER_NAME $IMAGE_NAME python3 -m pytest --cov=/path/to/project/path/to/main/package --cov-report=xml:/app/coverage.xml /path/to/project/path/to/tests/package --junit-xml=/app/pytest.xml
- docker cp $CONTAINER_NAME:/app/pytest.xml pytest.xml
- docker cp $CONTAINER_NAME:/app/coverage.xml coverage.xml
- sed -i "s|<source>/path/to/project/path/to/main/package</source>|<source>${CI_PROJECT_DIR}/path/to/main/package</source>|" coverage.xml
- cat coverage.xml
.....
artifacts:
reports:
junit: pytest.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
In the cat
output I can see that the source is now
/builds/my_company_name/my_project_name/path/to/main/package
The relative paths in the filename fields are correct paths to the files from the source path. I have confirmed the source path is correct with ls
.
At the end of the build is the message:
Uploading artifacts...
coverage.xml: found 1 matching files and directories
Uploading artifacts as "cobertura" to coordinator... 201 Created id=2638001478 responseStatus=201 Created token=hxygqbDC
Information about a changed file in the commit is mentioned in the coverage.xml
.
I do not see any noticeable changes to the commit information report in GitLab. I am not sure what to try next for debugging.
Thank you for your help.