Difference between coverage results with source specifies full dir instead of module name · Issue #426 · nedbat/coveragepy (original) (raw)

Originally reported by Alexander Todorov (Bitbucket: atodorov, GitHub: atodorov)


Anaconda, the Fedora Linux installer supports coverage collection via the API interface. If you boot with inst.debug then the main file /usr/sbin/anaconda will initialize coverage as one of the first things it does.

    cov = coverage.coverage(data_file="/mnt/sysimage/root/anaconda.coverage",
                            branch=True,
                            source=["/usr/sbin/anaconda", "pyanaconda"]
                            )
    cov.start()

The results are 105 files measured, which is short of 19 files which are also present in the pyanaconda module. OTOH if the source path is specified as the full path (e.g. /usr/lib64/python3.4/site-packages/pyanaconda) then all files inside are included in the coverage data. See:
rhinstaller/anaconda#397

I've tried to reproduce locally with the same directory structure (but not the same code) and was not able to. I will keep trying so it's easier to reproduce and easier to debug/fix.