Also record coverage for tests#3875
Also record coverage for tests#3875asottile wants to merge 1 commit intopytest-dev:masterfrom asottile:coverage_for_tests
Conversation
.coveragerc
Outdated
| @@ -1,4 +1,26 @@ | |||
| [run] | |||
| branch = True | |||
| source = . | |||
There was a problem hiding this comment.
Better use _pytest,testing here - less to omit then.
There was a problem hiding this comment.
hmm but then you have to have a special snowflake .coveragerc for each project
There was a problem hiding this comment.
?
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.
🤷♂️ no special omits here -- I copied this from one of my projects
There was a problem hiding this comment.
Still different than "defaults", no? :)
.coveragerc
Outdated
| ^if __name__ == ['"]__main__['"]:$ | ||
|
|
||
| # Intentionally skipped tests | ||
| ^\s*@pytest\.mark\.skipif |
There was a problem hiding this comment.
@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.
I don't see a reason to block on #2800 -- until then this improves local runs of isolated environments.
| 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.
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.
We're not trying to hit 100%
We're not? 😆
There was a problem hiding this comment.
Confirmation that, in fact, we are:
Ultimately we should strive to obtain 100% coverage...
There was a problem hiding this comment.
/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.
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.
|
|
||
|
|
||
| if os.environ.get("_ARGCOMPLETE"): | ||
| if os.environ.get("_ARGCOMPLETE"): # pragma: no cover |
There was a problem hiding this comment.
This one e.g. would be good to get covered in the long run.
There was a problem hiding this comment.
Don't you think this could be covered in the long run?
Agree 👍 |
|
I've rebased and set |
nicoddemus
left a comment
There was a problem hiding this comment.
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 :( |
|
|
||
|
|
||
| if os.environ.get("_ARGCOMPLETE"): | ||
| if os.environ.get("_ARGCOMPLETE"): # pragma: no cover |
There was a problem hiding this comment.
Don't you think this could be covered in the long run?
|
|
||
|
|
||
| else: | ||
| else: # pragma: no cover |
|
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.