Skip to content
Advertisement

Python coverage in Gitlab CI not showing any percentages

I am trying to make test coverage work for a python project. And I simply cannot figure out why there is no percentage showing neither in the tests nor the badge.

The command coverage report is called produces this output in the log:

JavaScript

and depending on the regex-expression that is saved in General > CI/CD, it simply looks for the 88% next to TOTAL. I used the recommended one for pytest-cov (Python) , i.e. ^TOTAL.+?(d+%)$ which works according to a regex checker.

regex expression

I also run coverage xml together with

JavaScript

which results in a successful upload of the file but I dont think this would be necessary for showing the basic percentages:

JavaScript

Either way, it is not working for me using: GitLab Community Edition 12.10.11. Any ideas anyone?

Advertisement

Answer

Fortunately, a friend of mine was able to help, referencing:

https://gitlab.com/gitlab-org/gitlab-foss/-/issues/48613

So in the end the regex didn’t fit even though it looks like it would. I guess what made it even more difficult was the other regex was recommended by Gitlab itself.

The correct regex is: *TOTAL.*s+(d+%)$*

TOTAL.*s+(d+%)$

As you can see, there is no (visual) difference to the one above…

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement