I it possible to have travis fail if my test don't have enough coverage, say < 90% for example.
Normally I run my tests with the following travis config entry.
script:
- coverage run --source="mytestmodule" setup.py test
According to this link, if you add the --fail-under
switch to the coverage report
command, it will exit with a non-zero exit code (which travis will see as a failure) if the code coverage is below the given percentage.
That would make the script section of your .travis.yml
file look like:
script
- coverage run --source="mytestmodule" setup.py test
- coverage report --fail-under=80
Of course you could replace 80 with whatever percentage you'd like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With