Switch from relative to absolute pathing for coverage reports - #18
Merged
Merged
Conversation
jdw-creare
marked this pull request as ready for review
April 7, 2026 16:00
|
scranford1
approved these changes
Apr 7, 2026
scranford1
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, thanks @jdw-creare.
Contributor
Author
|
Thanks Sam! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Short reason: To help with certain deployments that use podpac as a submodule, working around a limitation in the
coveragetool.Long reason:
coverage.xmlcoverage.xmlby first running the tests with thecoverage runcommand, which outputs a binary report (coverage.bin), then by converting that binary report to XML with thecoverage xmlcommand.coveragetool is done inpyproject.toml. Every repo has its own choices about which folders contain source and which ones should be ignored, so it makes sense to keep this configuration on a per-repo basis.coveragecommand can be configured to use absolute or relative paths by this file. There is not (that I have found) any way to override this at the command line. The choice of absolute or relative paths applies to allcoveragesubcommands, notablyrun,combine, andxml.coverage runwith relative paths,coverage xmlmust be run at the same working directory, orcoverage xmlwon't find the source and will fail. (I don't know whycoverage xmlrequires access to the source files)coverageto always use relative paths.For those repos, we wish to compute coverage, and combine them into one summary XML report. We have to run
coverage runin each submodule separately, to use each repo's coverage settings from itspyproject.toml. That's not a problem -coverage combinewill combine binary coverage reports. But if we use relative paths, then each call tocoverage xmlhas to occur with the same working directory as the initialcoverage run, orcoverage xmlwon't find the source files it needs. That's incompatible with runningcoverage runseveral times with different working directories.So the solution I lean toward is to run
coverage runandcoverage xmlwith absolute paths. SonarQube requires relative paths. It's pretty easy to convert an absolute path to a relative path in an XML file by usingsed. So there's a requiredsedcommand for each CI job, to get it back to relative paths.An alternative would be to generate one XML report for each submodule, and then stitch them together later. That's a much more involved level of text postprocessing, so I prefer this solution.
Since this is all a workaround for a limitation in
coverage, if someone finds a better workaround, or if there is an improvement to thecoveragetool so that we don't need to do this, we should switch back to relative paths.