Giving it your all, and then some? · Issue #743 · nedbat/coveragepy (original) (raw)

I really like this tool - it's saved my butt a fair amount, and has helped me write better code. Thank you for all that you do!

I recently wrote a quick tool, and when I finished writing all the tests and code, achieving that glorious 100% test coverage. ✨ 🎉

I wanted to ensure that the quality bar is now set high, so I figured I'd use the nifty --fail-under argument and set it to 100 - that works as I expected, yay!

Then I figured, I'm a bit of a smart-ass, what happens if I set the bar to something that is impossible, above 100%?

$ coverage report --fail-under=101 ; echo $? Name Stmts Miss Cover

myproject.py 39 0 100% 2

The comparison logic works fine - my setting is indeed higher than the reported coverage, but something deep inside of me asks - is that even possible?

I'm guessing that this is a case where my expectation would be that the tool tells me that I've asked for something impossible - to prevent me from accidentally committing a change that will then trip up the process. Is that reasonable?