Coverage percentage too low in merge request widget for py-pytest job

Describe the bug

When using the py-pytest job, the coverage figure displayed in merge request widgets is too small.

Expected behavior

Coverage figure in MR widget in the range of 0-100.

Actual behavior

Coverage figure in MR widget in the range of 0-10.

Logs and/or screenshots

Job run with default value:

image

Job run with the following appended to our own project's .gitlab-ci.yml (as suggested in GitLab docs for coverage):

py-pytest:
  coverage: /TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/

image

Context & Configuration

I don't have any public pipelines with this at the moment but I can create one when I have time if that's helpful.

The issue was reproduced using:

  • Version of the template: 7.1, but looks like this would still be the case in master
  • GitLab server(s): gitlab.com
  • GitLab runner(s): 17.4.0~pre.110.g27400594

Here is the .gitlab-ci.yml file:

variables:
  POETRY_HTTP_BASIC_REDACTED_USERNAME: ci_job_token
  POETRY_HTTP_BASIC_REDACTED_PASSWORD: $CI_JOB_TOKEN

include:
- component: $CI_SERVER_FQDN/components/secret-detection/secret-detection@1.1.2
- component: $CI_SERVER_FQDN/to-be-continuous/semantic-release/gitlab-ci-semrel@3.11.5
  inputs:
    info-on: prod
    release-disabled: true
- component: gitlab.com/to-be-continuous/python/gitlab-ci-python@7.1.0
  inputs:
    image: registry.hub.docker.com/library/python:3.10-slim
    mypy-args: --strict --install-types --non-interactive
    mypy-enabled: true
    mypy-files: ./packagename/
    pylint-enabled: true
    pylint-files: ./packagename/
    pytest-args: --cov=./packagename/ ./tests/
    pytest-enabled: true
    release-commit-message: "chore(release): {current_version}  {new_version} [skip ci]"
    release-enabled: true
    semrel-release-disabled: false

I'd be happy to make an MR for this and test other related things like coverage badges and coverage on other frameworks, but it might be small enough to include in some other work you are doing.