Support combining coverage data from different platforms/locations

Issue #17 resolved
Geoff Bache created an issue

I collect coverage data on both Linux and Windows as there is a fair amount of code in my system that differs between these platforms. I would therefore like to be able to use the -c option to combine this data, but of course the problem is that the same files are referred to in different ways. I'd therefore suggest the concept of an "alternative current working directory" whereby I can tell the coverage tool that a certain location is to be considered as equivalent to the local source tree. This could then also be used for example to combine data collected by different users on equivalent source, even if it wasn't cross-platform.

I enclose a patch which achieves this via a -A option on the command line (note this patch also includes the fixes for bugs 14 and 16, so is a quick way to get everything at once)

Comments (10)

  1. Geoff Bache reporter

    Hi again,

    As I was just patching this change into my version of coverage 3.4 (having previously done so for 3.2 and 3.3) I thought I'd ask if there was any prospect of this going in any time soon? It isn't particularly difficult and I'll happily provide a new patch against trunk if you want. Or make it work via the rc file if you prefer.


  2. Ned Batchelder repo owner

    Geoff, a patch against trunk for just one fix at a time would be great. I think the other two fixes in that patch are now in the code anyway. And yes, I am focusing primarily on the rc file as a way to add options. The command line is cluttered and not usable through testrunner plugins.

    About the code: I noticed the case-fixup for Windows, but it's only run if running on a posix os. Can you explain that to me?

  3. Geoff Bache reporter

    OK. I guess I should rework it to use the rc file then (presumably a new [combine] section). Any opinions on what the setting should be called?

    The point of the case-fixup for Windows is that the point of this is to combine paths from different platforms. Windows understands POSIX-style paths but the reverse is not true. The idea is to make this work for a "coverage combine" process running on a posix os, processing a file that has been produced on Windows.

  4. Geoff Bache reporter

    New patch provided: now works from rc file, is based on today's trunk and has no other changes included.

    I also attach a zipfile illustrating usage/testing: if you cd into "testcover" and then execute

    coverage combine --rcfile=rcfile ; coverage report

    it should report 100% on python source which cannot get 100% coverage using today's

  5. Vinay Sajip

    I'm still having trouble combining results from Windows and POSIX coverage runs, on 3.6b2 and 3.6b3. As it happens, although the projects are identical on both platforms, the project root directory is different on the two platforms. I don't know if this is why I'm getting a problem combining results. Ideally you would have a way of mapping project root directories on different machines so that combine can do the right thing.

    To reproduce, clone and do coverage run -p on Windows and POSIX machines, then attempt to do coverage combine with the individual .coverage files.

  6. Log in to comment