-
Notifications
You must be signed in to change notification settings - Fork 34
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
Exclude code from coverage #262
Comments
I wonder if this won't induce more use of |
On an other note, if we switch in a near future to jupyter notebooks for project/tutorials description, instead of using one script that generates plots and figures, maybe that could solve the problem (considering that every jupyter would be tested by a simple re-run ...) ? |
Well, we can always just ignore degradation.. but if the degradation comes from stuff like plotting, then I fail to see how to test that reasonably. Yet, if people just put in this pragma everywhere, nothing is gained, of course. But hey, no matter what we decide, this is what reviews are for.. |
Actually, excluding code from coverage seems to be a research subject itself, see this (interesting) article : https://homepages.dcc.ufmg.br/~andrehora/pub/2021-msr-test-coverage-exclusion.pdf From a first quick look, seems that the |
I like the statements. Jupyter is all well and good, but I do not want to rely on it. When I am making plots for a talk, for instance, I want nothing to do with Jupyter, but I still want the script to be in the repo. Also, now that you included markdown support with plots, I may choose that over Jupyter. I tested these pragmas here. I am not sure what to do about debugging statements. If I check that someone has put in the correct kind of parameters, I don't want to write a test for every way of triggering a debug statement, but the error messages may be broken, which others may care about. So I am in favour of excluding plotting only functions but nothing else. |
yeah ... 😅 ... this is actually still to be tested for markdown documentation on projects. I'm not totally set on the optimal structure for projects/tutorials/etc ... that would allow markdown documentation to be included in the website along with the sphinx-generated documentation of the API. But you have a good point tho : jupyter notebooks may be used for tutorial and project description (would be probably better), but you still need scripts to generate figures for article/presentation, tables, etc ... maybe those scripts should have a coverage-exclusion pattern, since I don't know really how to test them without saving figure data somewhere and testing comparison (which seems quite overkill ...) |
Second that. |
Yeah, good point. In |
So ... best practice would be to code tests that trigger errors ? Do you really want that for a code like pySDC ? 😅 |
That's my point. This is good practice, but honestly.. if the code fails right before it throws an error anyway... pff.. |
So, I'd be fine with excluding those blocks, too. At least for now. |
We should consider excluding code from coverage reports, e.g. plotting, error handling (won't test that anyway), terribly slow parts (unless we find a way to test it nonetheless)...
One way to do that is to use
# pragma: no cover
, see https://coverage.readthedocs.io/en/7.0.5/excluding.html.Thoughts?
The text was updated successfully, but these errors were encountered: