[TIP] Finding redundant pragma: no cover instances
ned at nedbatchelder.com
Thu Apr 5 04:24:11 PDT 2018
On 4/5/18 6:44 AM, Gordon Wrigley wrote:
> Is there an easy way to find pragma: no cover instances that aren't
> actually required. Aka ones that actually are covered? I have a code
> base with a bunch of these in and it'd be nice to slowly remove them,
> the first step in that is figuring out which of the current ones are
> actually necessary and which are historical.
There isn't a built-in feature to do this, but there's a way: edit your
.coveragerc file (or create one), and define a new pragma pattern (with
[report] exclude_lines), so that your existing "no cover" pragmas aren't
recognized. Then run coverage again. You can see how coverage is
reported for your "no cover" lines, and decide what to do about each
one. Then put back your original .coveragerc file.
> Regards G
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python