[run] omit is ignored since 4.5

Issue #638 resolved
Marius Gedminas created an issue

The coverage of irclog2html dropped from 100% to 98% after a cron-triggered Travis CI rebuild with no code changes. I investigated and discovered that despite my .coveragerc containing

source = irclog2html
omit = */tests/*,*/xchatlogsplit.py

the new version of coverage (4.5) does not omit src/irclog2html/tests/test_*.py from measurement or reporting.

This is probably related to commit 1031ead7ca4c.

Comments (7)

  1. Ned Batchelder repo owner

    @mgedmin Can you point me to the commit in your repo that shows the problem? And exactly how to reproduce the before/after?

  2. Marius Gedminas reporter

    https://github.com/mgedmin/irclog2html/commit/da8d6ec578bcafd6b121d474bb0b4a541de06a0b is a commit where make coverage reports 100% with coverage 4.4, but 98% (due to extra files with <100% coverage not being omitted) with coverage 4.5.

    (The "Also for some reason buildout-installed tools ignore my .coveragerc" part of the commit message was a misunderstanding on my part: buildout installed coverage 4.5 and was affected by this bug, but my globally pip-installed coverage was still at 4.4.)

    https://github.com/mgedmin/irclog2html/commit/3db55bd1de09539a906e02f9c924142b3410f588 is the workaround I applied to get the reporting back to 100%.

  3. Ned Batchelder repo owner

    Thanks. Looking at the .coverage files produced by 4.4.2 and 4.5, they are identical. So the [run]omit was never stopping the collecting of data for some reason. In 4.4.2, that setting was preventing the reporting, but it isn't in 4.5. I'll have to dig into it some more.

  4. Ned Batchelder repo owner

    The problem was that during measurement, omitting patterns weren't used inside source packages, only source directories. In the ambiguous case (such as you have) we interpret the source setting as a package. So the omit was being ignored (and has been for a while). It used to be that run-omit was also used for report-omit, so the data would be collected, but then omitted during reporting. Now that report-omit doesn't default to report-omit, the incorrectly collected data was being reported.

    In change 3ee6ac71eb08 I fixed the handling of omits inside source packages, so this is now fixed.

  5. Log in to comment