Skip to content

Added support for cov-min option to require coverage percentage #34

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Nov 25, 2014

Conversation

wolph
Copy link
Contributor

@wolph wolph commented Nov 24, 2014

Finally, a working pull-request

Last time I'm making a pull request from a train with a connection that's constantly timing out ;)

@schlamar
Copy link
Contributor

Thanks. But the tests still fail on Python 3.

And please add the following test cases for the new feature:

  • working case (total > cov_min)
  • error case (total < cov_min)
  • no output configured (--cov-report=): this probably crashes right now. Printing a summary to os.devnull to get the total should be working in this case.

@wolph
Copy link
Contributor Author

wolph commented Nov 24, 2014

Do you have a working test suite? Simply running tox doesn't appear to be doing much ;)

@schlamar
Copy link
Contributor

You need to run tox in pytest-cov subdirectory :)

I just updated the 2.0 branch, please rebase your changes.

@wolph
Copy link
Contributor Author

wolph commented Nov 24, 2014

The no output case isn't a problem in terms of stability since that just returns the default of 0% coverage right now. Besides that, it defaults to term in your code ;)

I've added the tests in any case.

@schlamar
Copy link
Contributor

Your test case is not testing disabled output. You need to pass --cov-report= explicitly without an parameter. In this case summary returns None (https://github.com/WoLpH/pytest-cov/blob/2.0/cov-core/cov_core.py#L82) which should crash, at least on Python 3.

@schlamar
Copy link
Contributor

Plus, returning 0 in the no output case is not the right behavior. total should still be correctly calculated.

@wolph
Copy link
Contributor Author

wolph commented Nov 25, 2014

Ah, I thought that wasn't an option here. Guess I was tricked by this line: https://github.com/schlamar/pytest-cov/blob/master/pytest_cov.py#L95
self.options.cov_report or ['term'],

@wolph
Copy link
Contributor Author

wolph commented Nov 25, 2014

If the pytest-cov plugin would have been enabled I wouldn't have missed this of course ;)

schlamar added a commit that referenced this pull request Nov 25, 2014
Added support for `cov-min` option to require coverage percentage
@schlamar schlamar merged commit dee6c36 into pytest-dev:2.0 Nov 25, 2014
@schlamar
Copy link
Contributor

Great. Thank you 🍰

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants