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

Removing message formatting rounding #611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pytest_cov/plugin.py
Expand Up @@ -341,7 +341,7 @@ def pytest_terminal_summary(self, terminalreporter):
markup = {'red': True, 'bold': True} if failed else {'green': True}
message = (
'{fail}Required test coverage of {required}% {reached}. '
'Total coverage: {actual:.2f}%\n'
'Total coverage: {actual}%\n'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would fix the problem you described without changing the output too dramatically.

Suggested change
'Total coverage: {actual}%\n'
'Total coverage: {truncate(actual, 2)}%\n'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right !

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could just reuse that from coverage? Hopefully @nedbat won't change it soon :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actively refactoring that file to make more of it public: https://github.com/nedbat/coveragepy/tree/nedbat/public-analysis . We could talk about how to make it useful here.

.format(
required=self.options.cov_fail_under,
actual=self.cov_total,
Expand Down