foo/bar.py echo "[run]\nrelative_files = true" > .coveragerc coverage run foo/bar.py coverage report -...">

relative_files & include broken since 7.0 · Issue #1604 · nedbat/coveragepy (original) (raw)

@ikonst

Describe the bug

  1. Create simple test case with relative_files = true
    mkdir foo
    echo 'print()" > foo/bar.py
    echo "[run]\nrelative_files = true" > .coveragerc
  2. coverage run foo/bar.py
  3. coverage report --include=foo/bar.py

Expected (as behavior was before 7.0):

Name         Stmts   Miss  Cover
--------------------------------
foo/bar.py       1      0   100%
--------------------------------
TOTAL            1      0   100%

Actual:

Additional analysis:

It appears that the regex created from the foo/bar.py glob pattern includes the current working directory, which might explain why it wouldn't match against relative paths anymore.