1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #118 new

Allow excluding entire modules/packages

Ram Rachum
created an issue

Allow excluding entire modules/packages from coverage measurement by including some identifiable string in their source, similarly to "pragma: no cover".

Here's a suggestion on how to do this, feel free to suggest alternatives: A line "pragma: no module cover" in a module will cause it not to be measured. A "pragma: no package cover" in an __init__.py file will cause the entire package, (including any submodules, subpackages, etc.) not to be measured.

Comments (3)

  1. Ned Batchelder repo owner

    I haven't looked into what it would take to implement this. Ram's original proposal included a new pragma for __init__.py to exclude the whole package. That would need to be different than the pragma for a single module, I think.

  2. Log in to comment