Coverage on a testing framework

Issue #341 closed
Pieter Rautenbach created an issue

We are extending the built-in unittest module of Python for our own purposes. The framework itself lives in (e.g.) my_package/testing. The tests for that framework is under my_package/tests.

When normally executing nosetests, it will exclude coverage on tests, unless --cover-tests is specified. What I need, though, is to see coverage on my testing framework, without seeing the coverage on the tests itself. I've tried to work around this using other inclusions/exclusions, but haven't got anything to work.

Any suggestions?

Comments (4)

  1. Ned Batchelder repo owner

    I don't use the nose coverage plugin, so I can't comment on how it is working. I've had better luck by skipping the plugin and using coverage to run nose:

    $ coverage run -m nose <nose args...>
    
  2. Pieter Rautenbach reporter

    Ned's suggestion solved my issue: It seems to be the nose plugin of coverage.py that makes assumptions and then filters directories starting with test (or after an underscore in the path). Running the coverage tool with nose as a loaded module, and then using the omit option to exclude coverage on tests, everything works as needed.

  3. Log in to comment