--omit still includes some files

Issue #323 closed
Former user created an issue

I run coverage using the python interface and albeit I am specifying omit="src/tests/,/usr/" in coverage.coverage(), I still get some entries like:

/usr/local/lib/python2.7/dist-packages/rauth-0.7.0-py2.7.egg/rauth/about

(actually the whole rauth package gets included, and only that one)

Comments (6)

  1. Ned Batchelder repo owner

    Can you provide a reproducible test case? Is there anything unusual about the rauth package? Can you try this:

    $ python
    >>> import rauth
    >>> print rauth
    

    and show the output? Also, the output of "coverage debug sys" will be helpful.

  2. Barry Warsaw

    Note that I also experience cases where [run]omit patterns do not actually omit everything. It's entirely possible I'm specifying the patterns incorrectly. I run coverage through a tox.ini environment and my tests include some subprocesses which get invoked through .tox/coverage/py34/bin. I still see

    .tox/coverage/lib/python3.4/distutils/__init__
    .tox/coverage/lib/python3.4/site-packages/pkg_resources
    

    no matter what I do. I can't omit all of .tox/coverage/lib/python3.4 because then I'd lose subproc coverage. I wonder if it could be an odd interaction between omit and source. I also have this in my tox.ini

    [paths]
    source =
        systemimage
        .tox/coverage/lib/python*/site-packages/systemimage
    

    Although I'm slowly working my way through some of the legitimate uncovered code, this is totally reproducible. If you feel brave, you can do the following, but it's only guaranteed to work on a recent-ish Ubuntu. 14.04 LTS or 14.10 should work.

    $ sudo apt-get build-dep system-image
    $ bzr branch lp:systemimage
    $ cd systemimage
    $ tox -e coverage
    

    The first command should pull in all the dependencies needed to build and run the test suite under coverage.

  3. Barry Warsaw

    Oh yeah - in the checked out branch, you won't see an explicit omit for the .tox/coverage files in coverage.ini. Since I've never been able to craft a working omit, I've left out any patterns in the committed branch. But I've tried tons of different combinations and not come up with anything that works.

  4. Loic Dachary

    Things changed in two years and here is what I get when running the steps to reproduce:

    bzr branch lp:systemimage
    bzr: ERROR: Not a branch: "bzr+ssh://bazaar.launchpad.net/+branch/systemimage/".
    

    I'm willing to work on this, is it still an issue ?

  5. Log in to comment