Generate coverage data using relative paths
MarkKoz opened this issue · 2 comments
Currently, coverage data is generated with absolute paths. This means that if the coverage file is moved across machines, the source code must be in the exact same location. The current workaround is to configure Docker to mount the host's code to the same exact directory within the container. However, this doesn't work for Windows machines since the host's path is not compatible on the Linux container.
The relative_files = true
setting can be added to .coveragerc
to fix this.
Note that coverage seems to rely on the correct file separator being used when generating coverage reports and combining data. In practice, this means that a Windows host will be unable to generate coverage reports since the data coming from the container will have paths with forward slashes. Until this is addressed by coverage.py, the current workaround for Windows users will be to generate coverage reports within the container. This should work for coverage report
; unsure about other formats such as HTML.
Is there an issue on coverage.py's repo as this sounds like a bug?
Yes, sort of nedbat/coveragepy#991