Skip to content

Out-of-the-box behavior unexpected by new users / Modify FAQ/QuickStart/Doc #1707

Closed
@buhtz

Description

@buhtz

I do run coverage via $ coverage -m pytest following the QuickStart section in your docs.

The problem is that the resulting report do contain two kinds of files that IMHO do not belong into a coverage report: test-files and python-standard-lib files. Here is a snipped from the report:

Name                                                                                  Stmts   Miss  Cover
---------------------------------------------------------------------------------------------------------
/home/user/mluCloud/my.work/bit/backintime/qt/plugins/notifyplugin.py                    35     22    37%
/home/user/mluCloud/my.work/bit/backintime/qt/plugins/systrayiconplugin.py               44     19    57%
/usr/lib/python3/dist-packages/PyQt5/__init__.py                                          1      0   100%
/usr/lib/python3/dist-packages/_distutils_hack/__init__.py                               98     93     5%
/usr/lib/python3/dist-packages/cairo/__init__.py                                         13     11    15%
/usr/lib/python3/dist-packages/cryptography/__about__.py                                  4      0   100%
/usr/lib/python3/dist-packages/cryptography/__init__.py                                   2      0   100%
...
/usr/lib/python3/dist-packages/six.py                                                   504    250    50%
applicationinstance.py                                                                   79      4    95%
backintime.py                                                                           534    258    52%
bcolors.py                                                                               18      8    56%
cli.py                                                                                  171    153    11%
config.py                                                                               952    428    55%
...
test/__init__.py                                                                          0      0   100%
test/generic.py                                                                         162      9    94%
test/test_applicationinstance.py                                                        162      0   100%
test/test_argparser.py                                                                  174      0   100%
test/test_backintime.py                                                                  55      2    96%
---------------------------------------------------------------------------------------------------------
TOTAL                                                                                 39172  22261    43%

Technically I do understand why this happens. But the users perspective and needs are what counts.
It is IMHO clear what a users expects from a coverage run. A user do not want to calculate the code coverage of test-files or python-standard-lib files. A user only want the code coverage of the productive code and nothing else.

This should be the default behavior.
Technically it is IMHO easy to know the test files using the same discover patters as pytest/unittest. It is similar for python-standard-lib files to always using the "dist-packages" folder.

If you disagree and do not want to implement that behavior that minimally mention this "problem" in the QuickStart and the FAQ or elsewhere in the docu. Also please mention a solution for that problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions