-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out-of-the-box behavior unexpected by new users / Modify FAQ/QuickStart/Doc #1707
Comments
I see your point about the third-party code (it's not standard-lib). Although many people feel as you do about test files, I absolutely disagree: You should include your tests in coverage. Try using |
Thanks for the link. I read it and understand your arguments. I disagree and could give opposite arguments. But I also assume you have more experience then me. So there is enough room in the future where I might change my opinion. :) But I wouldn't make this default behavior. The concept of test coverage is quit clear and in most cases this what users of tools like yours do expect. The question most users try to answer with your tool: "How much of my productive code is covered/executed by my test code?". Having test files and other things in it would violate that concept. You should be very clear and direct about that in your QuickStart guide that your tool do measure a lot more then just the test coverage. Not only mention the |
I can certainly try to clarify these factors in the quick start, though perhaps this is too much detail for there. The quick start already says:
The fact is, coverage.py knows almost nothing about tests. It monitors execution, and tells you what code ran and what code didn't. It doesn't try to distinguish between "test" code and "product" code. You can control that with a number of settings. |
But that behavior is not what most of users expect or what the tools name suggest. |
What do you think? 1adda03 |
Docs updated in that commit. |
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:
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.
The text was updated successfully, but these errors were encountered: