Fail tests when coverage not enough

Issue #1 wontfix
Jens Rantil
created an issue

Seems pretty empty here - I hope I am filing my issue in the right place.

I have a project where I aim to not loose coverage for my tests. Therefor I would love to have my test suite failing if coverage either above certain threshold (percentagewise or linewise). This would a really neat feature. Is this doable?

Comments (4)

  1. memedough repo owner

    This nose plugin controls coverage to produce a coverage report.

    Use a continuous integration server (e.g. Jenkins) to check the coverage report and fail if not good enough.

    If you still think that nose itself should fail the tests (instead of Jenkins) then please describe how you think it should work. I may accept a patch if it fits well with nose and the nose-cov plugin. Though this seems like the job of Jenkins rather than nose.

  2. Dmitry Medvinsky

    The built-in coverage plugin for nose has an option --cover-min-percentage. If you, say, run nosetests --with-cover --cover-min-percentage=95 and your coverage is below 95%, nosetests will exit with code 1 which makes it very easy to mark build as failed in Jenkins.

    So, maybe such an option might be available in nose-cov, too.

  3. Log in to comment