Skip to content
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

Report hasn't the TOTAL line if one file is tested only #922

Closed
mosling opened this issue Jan 15, 2020 · 4 comments
Closed

Report hasn't the TOTAL line if one file is tested only #922

mosling opened this issue Jan 15, 2020 · 4 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request report wontfix This will not be worked on

Comments

@mosling
Copy link

mosling commented Jan 15, 2020

Describe the bug
A very simple setup, I have one python script (script.py) and a test for this script (script_test.py).

The result for coverage run -m pytest and coverage report is

Name            Stmts   Miss  Cover
-----------------------------------
adder.py            2      0   100%
adder_test.py       7      1    86%
-----------------------------------
TOTAL               9      1    89%

But the same with coverage run --omit='*_test.py' -m pytest and coverage report results into

Name       Stmts   Miss  Cover
------------------------------
adder.py       2      0   100%

The summary line with TOTAL is missing
I use GitLab and look for the TOTAL line to catch the test coverage.

To Reproduce
How can we reproduce the problem? Please be specific.

  1. Python 3.8.0
  2. Coverage.py, version 5.0.3 with C extension
  3. Example project at https://github.com/mosling/coverage-example

Expected behavior
TOTAL line should appear in every case. It is important for data processing to have the same behavior in each case, I never see the output ;-)

@mosling mosling added the bug Something isn't working label Jan 15, 2020
@nedbat
Copy link
Owner

nedbat commented Jan 15, 2020

This has been reported before, in #732. My advice there was to simply read the last word on the last line of the report, which will be what you want in all cases. But now, as of version 5.0, there's a better answer: use the "coverage json" report, and read the number programmatically.

@nedbat
Copy link
Owner

nedbat commented Jan 15, 2020

@mosling Also, I'm curious what you use the total number for. Maybe there's a better way we can provide it. Do you know about the --fail-under option?

@nedbat nedbat added enhancement New feature or request report and removed bug Something isn't working labels Jan 15, 2020
@nedbat nedbat added wontfix This will not be worked on duplicate This issue or pull request already exists labels Jan 26, 2020
@nedbat nedbat closed this as completed Jan 26, 2020
@nedbat
Copy link
Owner

nedbat commented Jan 6, 2021

Now with #1091, the TOTAL line is always output.

@nedbat
Copy link
Owner

nedbat commented Jan 26, 2021

This is now released as part of coverage 5.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request report wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants