More viewing options for code coverage
Code coverage is a great future. I just started to use it today (don't laugh at me, I'm that outdated), and in both cases where uncovered lines showed me how I incorrectly assumed how the code would run. Yeah, it caught two bugs for me already.
There at least two very desirable features not yet available but could make this already powerful tool even better:
1. Allow marking certain uncovered lines of code as ignored:
There are at least two legitimate scenarios where you want them ignored:
a) The branch of lines will throw an exception that you don't want to test. For instance, you have an Enum type and a block of code acting on all possible values of the enum, an exception is there to guard future expansion to the Enum type.
b) In python, @abstractmethod of an abstract class:
@abstractmethod
def _visit_spot(self, spot: Spot):
pass
the 'pass' here is required as indent is expected, but 'pass' will never be covered by definition.
2. Allow folding the covered lines of a file, that is, allowing only displaying uncovered lines of a source file. This will help the developer quickly find the uncovered lines and be alarmed by potential bugs.
Without these two features, as a project grows its size, uncovered lines will gradually accumulate and meaningful newly discovered uncovered lines will be buried in uncovered lines the developer always ignores. This will increase the possibility that the developer fails to be alarmed by the newly reported uncovered lines.
Please sign in to leave a comment.
These are quite reasonable feature requests.
Please file them separately to https://youtrack.jetbrains.com/issues/PY so that other users can vote for them and leave comments.
Issue created:
https://youtrack.jetbrains.com/issue/PY-43306