Mis-configured combine paths produce useless results

Issue #608 closed
Ned Batchelder repo owner created an issue
$ mkdir code code/sub
$ cat > code/sub/mod.py
print("Hello")
$ cat > .coveragerc
[paths]
source =
  code/sub
  code
$ coverage run --parallel code/sub/mod.py
Hello
$ cat .coverage.dhcp-18-189-21-130.dyn.mit.edu.983.832948
!coverage.py: This is a private format, don't read it directly!{"lines":{"/Users/ned/foo/jbug2/code/sub/mod.py":[1]}}
$ coverage combine
$ cat .coverage
!coverage.py: This is a private format, don't read it directly!{"lines":{"/Users/ned/foo/jbug2/code/sub/sub/mod.py":[1]}}
$ coverage report
code/sub/sub/mod.py   NoSource: No source for code: '/Users/ned/foo/jbug2/code/sub/sub/mod.py'.
Aborting report output, consider using -i.
Name    Stmts   Miss  Cover
---------------------------
No data to report.

The combine paths overlap. This should be an error. In the real situation, the overlap was mistakenly created by having paths with environment variables in them, and one of the variables was empty by mistake.

Comments (3)

  1. Ned Batchelder reporter

    I'm not sure what is the mistake here:

    1. is it always wrong for combine paths to overlap, or are there valid reasons to need it?
    2. should we have found the match against the first path instead of the second? That would have avoided the problem.
    3. should we insist that the resulting path actually exist on the machine doing the combining?

    Would it be enough to warn in one of these situations instead of failing?

  2. Log in to comment