Option to use relative file paths in xml report · Issue #948 · nedbat/coveragepy (original) (raw)
Is your feature request related to a problem? Please describe.
There is an option for run
command to store only relative file paths. It is very useful while running your tests inside one environment(e.g. docker) and using results in another one(e.g. on Jenkins node). It is also common to generate cobertura report in the same environment you are running tests, but this report always includes absolute path for sources(I think, because of this line). This way it is impossible for tools like Jenkins Cobertura plugin or Sonarqube to find source files properly(Sonarqube either fails to parse coverage report at all or raises warning, for example).
Describe the solution you'd likejson
reports use paths from .coverage
file and thus respect this relative_files
setting from run
section.
It would be nice either to not canonicalize paths for sources or to have an option which will skip path normalization(this way it may be more backward compatible)
Describe alternatives you've considered
I tried to use combine
and define sources in [path]
section of config but it ends up with absolute path in the end report anyway.