What is pytest result mean? The 2019 Stack Overflow Developer Survey Results Are InWhat does ** (double star/asterisk) and * (star/asterisk) do for parameters?What are metaclasses in Python?What is the difference between @staticmethod and @classmethod?What does the “yield” keyword do?What does if __name__ == “__main__”: do?What is __init__.py for?What is the meaning of a single and a double underscore before an object name?What is setup.py?What is the Python 3 equivalent of “python -m SimpleHTTPServer”Meaning of @classmethod and @staticmethod for beginner?
How to translate "being like"?
Did any laptop computers have a built-in 5 1/4 inch floppy drive?
How to support a colleague who finds meetings extremely tiring?
Short story: child made less intelligent and less attractive
Are there any other methods to apply to solving simultaneous equations?
Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?
Why not take a picture of a closer black hole?
RequirePermission not working
A word that means fill it to the required quantity
What do these terms in Caesar's Gallic Wars mean?
What is preventing me from simply constructing a hash that's lower than the current target?
Mathematics of imaging the black hole
Match Roman Numerals
How to type this arrow in math mode?
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
Keeping a retro style to sci-fi spaceships?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
How to type a long/em dash `—`
Is bread bad for ducks?
Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers?
Can withdrawing asylum be illegal?
Can we generate random numbers using irrational numbers like π and e?
Why can I use a list index as an indexing variable in a for loop?
Is it safe to harvest rainwater that fell on solar panels?
What is pytest result mean?
The 2019 Stack Overflow Developer Survey Results Are InWhat does ** (double star/asterisk) and * (star/asterisk) do for parameters?What are metaclasses in Python?What is the difference between @staticmethod and @classmethod?What does the “yield” keyword do?What does if __name__ == “__main__”: do?What is __init__.py for?What is the meaning of a single and a double underscore before an object name?What is setup.py?What is the Python 3 equivalent of “python -m SimpleHTTPServer”Meaning of @classmethod and @staticmethod for beginner?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm learning about testing in Python, and now I'm using pytest-cov.
I try to run this command:
pytest --cov=myProj tests/ --cov-report term-missing
after the testing done I got the report like this:
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
myProject/__init__.py 0 0 100%
myProject/alert.py 14 14 0% 1-21
myProject/api/__init__.py 1 0 100%
myProject/api/spaces/__init__.py 0 0 100%
myProject/api/spaces/admin.py 279 179 36% 154-223, 312-335, 351-398, 422-432, 505-515, 534-565, 591-697
myProject/api/spaces/global.py 89 66 26% 35-43, 47-69, 72-92, 96-124
myProject/api/spaces/inventory.py 79 79 0% 1-119
myProject/api/spaces/keyword.py 134 110 18% 33-42, 46-68, 72-93, 101-112, 116-134, 138-165, 168-190
A few things that make me still confuse about the report that I still didn't find it in the documentation are about:
what is
Stmts, Miss, Cover, and Missing, is that if the result on Cover doesn't 100% it means my code still bad or what..?
python python-3.x unit-testing pytest pytest-cov
add a comment |
I'm learning about testing in Python, and now I'm using pytest-cov.
I try to run this command:
pytest --cov=myProj tests/ --cov-report term-missing
after the testing done I got the report like this:
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
myProject/__init__.py 0 0 100%
myProject/alert.py 14 14 0% 1-21
myProject/api/__init__.py 1 0 100%
myProject/api/spaces/__init__.py 0 0 100%
myProject/api/spaces/admin.py 279 179 36% 154-223, 312-335, 351-398, 422-432, 505-515, 534-565, 591-697
myProject/api/spaces/global.py 89 66 26% 35-43, 47-69, 72-92, 96-124
myProject/api/spaces/inventory.py 79 79 0% 1-119
myProject/api/spaces/keyword.py 134 110 18% 33-42, 46-68, 72-93, 101-112, 116-134, 138-165, 168-190
A few things that make me still confuse about the report that I still didn't find it in the documentation are about:
what is
Stmts, Miss, Cover, and Missing, is that if the result on Cover doesn't 100% it means my code still bad or what..?
python python-3.x unit-testing pytest pytest-cov
add a comment |
I'm learning about testing in Python, and now I'm using pytest-cov.
I try to run this command:
pytest --cov=myProj tests/ --cov-report term-missing
after the testing done I got the report like this:
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
myProject/__init__.py 0 0 100%
myProject/alert.py 14 14 0% 1-21
myProject/api/__init__.py 1 0 100%
myProject/api/spaces/__init__.py 0 0 100%
myProject/api/spaces/admin.py 279 179 36% 154-223, 312-335, 351-398, 422-432, 505-515, 534-565, 591-697
myProject/api/spaces/global.py 89 66 26% 35-43, 47-69, 72-92, 96-124
myProject/api/spaces/inventory.py 79 79 0% 1-119
myProject/api/spaces/keyword.py 134 110 18% 33-42, 46-68, 72-93, 101-112, 116-134, 138-165, 168-190
A few things that make me still confuse about the report that I still didn't find it in the documentation are about:
what is
Stmts, Miss, Cover, and Missing, is that if the result on Cover doesn't 100% it means my code still bad or what..?
python python-3.x unit-testing pytest pytest-cov
I'm learning about testing in Python, and now I'm using pytest-cov.
I try to run this command:
pytest --cov=myProj tests/ --cov-report term-missing
after the testing done I got the report like this:
----------- coverage: platform linux, python 3.6.7-final-0 -----------
Name Stmts Miss Cover Missing
----------------------------------------------------------------------------------------------
myProject/__init__.py 0 0 100%
myProject/alert.py 14 14 0% 1-21
myProject/api/__init__.py 1 0 100%
myProject/api/spaces/__init__.py 0 0 100%
myProject/api/spaces/admin.py 279 179 36% 154-223, 312-335, 351-398, 422-432, 505-515, 534-565, 591-697
myProject/api/spaces/global.py 89 66 26% 35-43, 47-69, 72-92, 96-124
myProject/api/spaces/inventory.py 79 79 0% 1-119
myProject/api/spaces/keyword.py 134 110 18% 33-42, 46-68, 72-93, 101-112, 116-134, 138-165, 168-190
A few things that make me still confuse about the report that I still didn't find it in the documentation are about:
what is
Stmts, Miss, Cover, and Missing, is that if the result on Cover doesn't 100% it means my code still bad or what..?
python python-3.x unit-testing pytest pytest-cov
python python-3.x unit-testing pytest pytest-cov
edited Mar 22 at 7:12
Harvest 1018
asked Mar 22 at 5:03
Harvest 1018Harvest 1018
1461115
1461115
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Stmts
refers to the number of statements in your code.
Miss
refers to the number of statements that have not been run.
Cover
is test coverage, or (Stmts - Miss) / 100
.
Missing
contains the line numbers of the Miss
statements.
If coverage is not 100%, that means that there are parts of your code that your tests do not cover, for example:
def f(a, b):
if a > 0:
return a
elif a == 0:
return 0
else:
return b
def test_f():
assert f(10, 10)
The above test will only ever enter the a > 0
branch and will therefore have a test coverage of 33%.
High coverage is not always good (because just covering code doesn't mean that all cases are tested adequately), but low coverage is often bad (because that means your tests are not even touching parts of your code).
add a comment |
Stmts - means the total lines of code you have in a specific file.
Miss - total number of lines that are not covered by unittest.
Cover - percentage of all line of code that are covered by unittest.
Missing - lines of codes that are not covered.
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293195%2fwhat-is-pytest-result-mean%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Stmts
refers to the number of statements in your code.
Miss
refers to the number of statements that have not been run.
Cover
is test coverage, or (Stmts - Miss) / 100
.
Missing
contains the line numbers of the Miss
statements.
If coverage is not 100%, that means that there are parts of your code that your tests do not cover, for example:
def f(a, b):
if a > 0:
return a
elif a == 0:
return 0
else:
return b
def test_f():
assert f(10, 10)
The above test will only ever enter the a > 0
branch and will therefore have a test coverage of 33%.
High coverage is not always good (because just covering code doesn't mean that all cases are tested adequately), but low coverage is often bad (because that means your tests are not even touching parts of your code).
add a comment |
Stmts
refers to the number of statements in your code.
Miss
refers to the number of statements that have not been run.
Cover
is test coverage, or (Stmts - Miss) / 100
.
Missing
contains the line numbers of the Miss
statements.
If coverage is not 100%, that means that there are parts of your code that your tests do not cover, for example:
def f(a, b):
if a > 0:
return a
elif a == 0:
return 0
else:
return b
def test_f():
assert f(10, 10)
The above test will only ever enter the a > 0
branch and will therefore have a test coverage of 33%.
High coverage is not always good (because just covering code doesn't mean that all cases are tested adequately), but low coverage is often bad (because that means your tests are not even touching parts of your code).
add a comment |
Stmts
refers to the number of statements in your code.
Miss
refers to the number of statements that have not been run.
Cover
is test coverage, or (Stmts - Miss) / 100
.
Missing
contains the line numbers of the Miss
statements.
If coverage is not 100%, that means that there are parts of your code that your tests do not cover, for example:
def f(a, b):
if a > 0:
return a
elif a == 0:
return 0
else:
return b
def test_f():
assert f(10, 10)
The above test will only ever enter the a > 0
branch and will therefore have a test coverage of 33%.
High coverage is not always good (because just covering code doesn't mean that all cases are tested adequately), but low coverage is often bad (because that means your tests are not even touching parts of your code).
Stmts
refers to the number of statements in your code.
Miss
refers to the number of statements that have not been run.
Cover
is test coverage, or (Stmts - Miss) / 100
.
Missing
contains the line numbers of the Miss
statements.
If coverage is not 100%, that means that there are parts of your code that your tests do not cover, for example:
def f(a, b):
if a > 0:
return a
elif a == 0:
return 0
else:
return b
def test_f():
assert f(10, 10)
The above test will only ever enter the a > 0
branch and will therefore have a test coverage of 33%.
High coverage is not always good (because just covering code doesn't mean that all cases are tested adequately), but low coverage is often bad (because that means your tests are not even touching parts of your code).
answered Mar 22 at 5:09
gmdsgmds
5,573525
5,573525
add a comment |
add a comment |
Stmts - means the total lines of code you have in a specific file.
Miss - total number of lines that are not covered by unittest.
Cover - percentage of all line of code that are covered by unittest.
Missing - lines of codes that are not covered.
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
add a comment |
Stmts - means the total lines of code you have in a specific file.
Miss - total number of lines that are not covered by unittest.
Cover - percentage of all line of code that are covered by unittest.
Missing - lines of codes that are not covered.
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
add a comment |
Stmts - means the total lines of code you have in a specific file.
Miss - total number of lines that are not covered by unittest.
Cover - percentage of all line of code that are covered by unittest.
Missing - lines of codes that are not covered.
Stmts - means the total lines of code you have in a specific file.
Miss - total number of lines that are not covered by unittest.
Cover - percentage of all line of code that are covered by unittest.
Missing - lines of codes that are not covered.
edited Mar 22 at 8:06
Harvest 1018
1461115
1461115
answered Mar 22 at 5:13
Reymart BetanaReymart Betana
546
546
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
add a comment |
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
I'm still don't got it about Stmts, because at my report that in my real project, I have 54 lines (whitout lines break) in my file and 26 lines in my test file (also without line break), but in my report the Stmts it showing 28.
– Harvest 1018
Mar 22 at 7:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293195%2fwhat-is-pytest-result-mean%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown