Feature request: Report when excluded lines are executed

Issue #619 duplicate
Toshio Kuratomi
created an issue

I've found that I use coverage's exclude_lines configuration[1] to exclude code that I determine is unreachable in the environment under test. For me, this doesn't mean code like repr() which could be called during a test run but things shielded by "if False:" or by "if six.PY3" under Python2[2].

_[1]: http://coverage.readthedocs.io/en/coverage-4.2/excluding.html

_[2]: https://anonbadger.wordpress.com/2017/11/24/better-unittest-coverage-stats-excluding-code-that-only-executes-on-python-2-3/

I talked to a detractor of this usage of excluding lines from the reports and realized that for my use case it would be helpful if I could have a configuration switch which would make coverage report when code that I've marked for exclusion was executed. If it's executed, then it's obviously not unreachable which means that either my code isn't doing what I thought it was or my listing the code for exclusion from the coverage report should be revisited. (It needs to be a toggle since some people will have different use cases than I do. For instance, the use case in coverage's docs about marking debugging-only code for exclusion would want to toggle this new feature off).

Comments (3)

  1. Log in to comment