-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Also record coverage for tests #3875
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
Conversation
.coveragerc
Outdated
@@ -1,4 +1,26 @@ | |||
[run] | |||
branch = True | |||
source = . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use _pytest,testing
here - less to omit then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm but then you have to have a special snowflake .coveragerc
for each project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
I think it is OK for a project to have its own sources defined here - after all you would then have special omits instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️ no special omit
s here -- I copied this from one of my projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still different than "defaults", no? :)
.coveragerc
Outdated
^if __name__ == ['"]__main__['"]:$ | ||
|
||
# Intentionally skipped tests | ||
^\s*@pytest\.mark\.skipif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pytest\.mark\.skipif
should not be excluded: one of the builds should hit it.
(more relevant with/after #2800)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason to block on #2800 -- until then this improves local runs of isolated environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2,7 +2,7 @@ | |||
|
|||
try: | |||
from ._version import version as __version__ | |||
except ImportError: | |||
except ImportError: # pragma: no cover | |||
# broken installation, we don't even try | |||
# unknown only works because we do poor mans version compare | |||
__version__ = "unknown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better leave this code as uncovered.
We're not trying to hit 100%, but is is OK for this to be not covered - also for other things below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not trying to hit 100%
We're not? 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmation that, in fact, we are:
Ultimately we should strive to obtain 100% coverage...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @nicoddemus
I think the crucial part from there is:
Even if we "cheat", we gain the benefit of demanding that new code from now on has 100% coverage.
This should be achieved instead by requiring a diff to be covered 100% - something which codecov provides then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it is ok to add some # pragma: no cover
here and there for code that we can't really cover on tests in a practical manner, here is a prime example of that: this is just a safe guard for broken pytest installations.
@@ -88,7 +88,7 @@ def __call__(self, prefix, **kwargs): | |||
return completion | |||
|
|||
|
|||
if os.environ.get("_ARGCOMPLETE"): | |||
if os.environ.get("_ARGCOMPLETE"): # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one e.g. would be good to get covered in the long run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think this could be covered in the long run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be trimmed down to only expanding sources to _pytest,testing
.
And it should get rebased on master after we have basic codecov, via #3877.
Agree 👍 |
I've rebased and set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @asottile!
@blueyed -- I'll defer to your review -- let me know if/when this is mergeable! |
Codecov Report
@@ Coverage Diff @@
## master #3875 +/- ##
==========================================
- Coverage 92.59% 92.22% -0.37%
==========================================
Files 51 104 +53
Lines 9960 23189 +13229
Branches 0 2285 +2285
==========================================
+ Hits 9222 21386 +12164
- Misses 738 1436 +698
- Partials 0 367 +367
Continue to review full report at Codecov.
|
@asottile |
what's the reason? |
@asottile |
I'm sorry, can you highlight what portions of the PR you're in opposition to and your rationale for opposing them? I'm not sure I'm understanding :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -88,7 +88,7 @@ def __call__(self, prefix, **kwargs): | |||
return completion | |||
|
|||
|
|||
if os.environ.get("_ARGCOMPLETE"): | |||
if os.environ.get("_ARGCOMPLETE"): # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you think this could be covered in the long run?
@@ -99,7 +99,7 @@ def try_argcomplete(parser): | |||
argcomplete.autocomplete(parser, always_complete_options=False) | |||
|
|||
|
|||
else: | |||
else: # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
I gather that now that #3920 has been merged we can pick this up again? |
I guess there's no point now that @blueyed cherry picked all the parts out |
As seen in #3873, there's sneaky dead code lurking in
./testing
. Let's surface that a little bit better.I started combing through the results but didn't get terribly far.