Skip to content

Docs feedback: Test Coverage Visualization for python

Request

As a python developper, I'll like to see a .gilab-ci.yml code snippet to activate the option with pytest.

Current unsuccessful snippet

I've tried:

.only-default: &only-default
  only:
    - merge_requests

stages:
  - test

test-py:
  stage: test
  image: "python:3.8"
  script:
    - pip install -r requirements.txt
    - python -m pytest -vvv  src --cov-report xml --cov=src
  artifacts:
    reports:
      cobertura: coverage.xml

Among other packages used for my project, the requirements.txt file contains pytest and pytest-cov.

The associated pipeline outputted:

Uploading artifacts...
coverage.xml: found 1 matching files and directories 
Uploading artifacts as "cobertura" to coordinator... ok  id=858390324 responseStatus=201 Created token=6uBetoBX

But I'm unable to see the new feature in my MR.

Reference page

https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html

Edited by Alexandre Cameron