File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,28 @@ Alternatively, this can also be configured for all occurrences:
304304 `Configuration reference
305305 <https://coverage.readthedocs.io/en/latest/config.html> `_
306306
307+ .. _coverage_tip :
308+
309+ .. tip ::
310+ Many people exclude tests from test coverage: `omit tests
311+ path:**/pyproject.toml
312+ <https://github.com/search?q=omit+tests+path%3A**%2Fpyproject.toml&type=code> `_.
313+ However, this is a bad idea. Your tests are real code, and the whole point of
314+ test coverage is to give you information about your code. Why wouldn’t you
315+ want this information about your tests?
316+
317+ You might say, *‘All my tests run the entire code, so it’s useless
318+ information.’ * However, if you write a new test and copy an existing test for
319+ it, changing only the execution but not the function name, only one of the
320+ two test functions will be executed. And are you sure that every piece of
321+ helper code in your test suite is still needed? Coverage would alert you to
322+ this problem in both cases.
323+
324+ One argument against test coverage is that it artificially inflates the
325+ reports. But you can easily exclude these files from the report with
326+ `[report] skip_covered
327+ <https://coverage.readthedocs.io/en/latest/config.html#report-skip-covered> `_.
328+
307329Extensions
308330----------
309331
You can’t perform that action at this time.
0 commit comments