# Add coverage testing of unittest

XMLWordPrintable

## Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
3
• Team:
Architecture

## Description

The pytest-cov plugin should be enabled to write coverage reports from unit testing. This ticket covers the work to enable per-product coverage testing solely from the unittests associated with that product. This can be enabled as part of normal test execution. It is possible to write coverage results to html, the terminal and XML. XML is needed for Jenkins support – it may be desirable to default to HTML and terminal reporting but allow Jenkins to enable XML output via an environment variable.

## Activity

Hide
Tim Jenness added a comment -

I've pushed some test code to experiment with this test coverage.

Show
Tim Jenness added a comment - I've pushed some test code to experiment with this test coverage.
Hide
Tim Jenness added a comment -

John Parejko Thanks for agreeing to look at this. I was delaying merging this because I wasn't entirely sure what Joshua Hoblitt wants to do with the coverage output on Jenkins. I think to first order we can enable it without having to decide how people see the output on Jenkins.

Show
Tim Jenness added a comment - John Parejko Thanks for agreeing to look at this. I was delaying merging this because I wasn't entirely sure what Joshua Hoblitt wants to do with the coverage output on Jenkins. I think to first order we can enable it without having to decide how people see the output on Jenkins.
Hide
Joshua Hoblitt added a comment -

I wasn't aware that I was blocking this ticket. I was waiting for it be enabled before implementing reporting on the jenkins side; this is the critical path direction that is in jira as well.

Show
Joshua Hoblitt added a comment - I wasn't aware that I was blocking this ticket. I was waiting for it be enabled before implementing reporting on the jenkins side; this is the critical path direction that is in jira as well.
Hide
Tim Jenness added a comment -

Don't worry about it. It was a long time ago and I think I was at the point of wanting to discuss options with you but then got distracted.

Show
Tim Jenness added a comment - Don't worry about it. It was a long time ago and I think I was at the point of wanting to discuss options with you but then got distracted.
Hide
Russell Owen added a comment -

This looks like a useful addition. I had some requests for clarification and doc fixes on github, but nothing major

Show
Russell Owen added a comment - This looks like a useful addition. I had some requests for clarification and doc fixes on github, but nothing major
Hide
Tim Jenness added a comment - - edited

I have updated the code based on John Parejko's review on GitHub. He reports on Slack that he is okay with writing coverage HTML files into tests/.test/pytest-PACKAGE.xml-htmlcov/ – this simplifies the code path significantly since it can now use the SCons ${TARGET} scheme. I am currently running a Jenkins job and will merge when that completes. Show Tim Jenness added a comment - - edited I have updated the code based on John Parejko 's review on GitHub. He reports on Slack that he is okay with writing coverage HTML files into tests/.test/pytest-PACKAGE.xml-htmlcov/ – this simplifies the code path significantly since it can now use the SCons${TARGET} scheme. I am currently running a Jenkins job and will merge when that completes.
Hide
Tim Jenness added a comment -

Coverage is now enabled. The next step is to integrate the output into Jenkins.

Show
Tim Jenness added a comment - Coverage is now enabled. The next step is to integrate the output into Jenkins.

## People

• Assignee:
Tim Jenness
Reporter:
Tim Jenness
Reviewers:
John Parejko
Watchers:
Gabriele Comoretto, John Parejko, Joshua Hoblitt, Kian-Tat Lim, Russell Owen, Tim Jenness