-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support coverage
's exclude_lines
setting
#26
Comments
exclude_lines
setting coverage
's exclude_lines
setting
Mmm, I wonder how coverage implements these... go through the source matching and collect the set of lines that match, excluding them? That would seem easier than matching in the AST... |
Yes, it's a regex on the raw line.
It cannot be done using AST because the patterns in |
Semi-related, is there any way to exclude code blocks with if condition: # pragma: no cover
print() # will not be covered |
No, SlipCover doesn't currently support this, sorry. |
Being unable to exclude blocks is pretty much a blocker for me - I'd have to comment every line or live with a big reported regression in coverage, neither of which is desirable. |
I hear you, folks. I will work on this ASAP. |
Idk if you'd consider it part of this more general feature, but not counting stuff like |
I wasn't accurate in a previous issue: this feature is also gating for my project.
In real-world programs, there are significant quantities of code within otherwise tested files which are deliberately not unit tested due to diminishing returns and finite resources.
coverage
uses theexclude_lines
configuration file setting to match lines and scopes not to be included in coverage, usually with a specific comment - docs.This is informative when reading code, and it also gives a more useful measure of actual coverage.
This sounds harder than my previous issues, because of the fact it applies to scopes as well as single lines.
coverage
has a ton of other features, several of which we do use, but IMHO these two are the most important.Thanks again for a very promising library!
The text was updated successfully, but these errors were encountered: