-
-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
[run] | ||
branch = True | ||
source = _pytest,testing | ||
omit = | ||
# standlonetemplate is read dynamically and tested by test_genscript | ||
*standalonetemplate.py | ||
.tox/* | ||
/usr/* | ||
setup.py | ||
|
||
[report] | ||
show_missing = True | ||
skip_covered = True | ||
exclude_lines= | ||
# Have to re-enable the standard pragma | ||
\#\s*pragma: no cover | ||
|
||
# Don't complain if tests don't hit defensive assertion code: | ||
^\s*raise AssertionError\b | ||
^\s*raise NotImplementedError\b | ||
^\s*return NotImplemented\b | ||
^\s*raise$ | ||
|
||
# Don't complain if non-runnable code isn't run: | ||
^if __name__ == ['"]__main__['"]:$ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Don't you think this could be covered in the long run? |
||
try: | ||
import argcomplete.completers | ||
except ImportError: | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Same. |
||
|
||
def try_argcomplete(parser): | ||
pass | ||
|
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? 😆
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:
#2800 (review)
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:
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.