Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Showing coverage in pipelines for python project

Jesper Jaxing July 26, 2018

Hi,
I'm using coverage.py to test the coverage of my project. As I understand it by using the --xml flag for coverage.py I get an xml format called cobertura which bitbucket pipelines can't use to display test coverage. I then found the this tool that converts cobertura to clover formated xml.

After the transformation my xml file has this format:

<coverage generated="1532606642579">

      <project timestamp="1532606642579">

                      <file name="file_name.py"><line type....></file>

                    .....

            <metrics ncols="2254" coveredelements="1786" elements="2254"/>
     </project>

</coverage>

Still all I see in the tear down part of the step is

Cache "pip": Skipping upload for existing cache
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Found matching test report file /opt/atlassian/pipelines/agent/build/test-results/coverage.xml
Finished scanning for test reports. Found 1 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors

 The generation of coverage and the conversion of the xml file is done in the same step as the tests are run by the following commands

coverage xml --fail-under=70 -o ./test-results/coverage.xml
cobertura-clover-transform test-results/coverage.xml -o test-results/coverage.xml

Can anyone see any reason for why this shouldn't make pipelines show me test coverage?

Thanks!

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 23, 2018

Hello Jesper,

Code coverage is not a part of the Test Reporting feature. The test reporting view only shows the logs of Failed tests, read from the xUnit/JUnit test reporting standard. There is currently no support for any code coverage tools.

We have a feature request for Code Coverage support (such as Cobertura) that you can follow: https://bitbucket.org/site/master/issues/15935/add-support-for-code-coverage-tools-like

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events