[TIP] check for actual assertions in tests

Alexandre Conrad alexandre.conrad at gmail.com
Fri Nov 14 10:00:40 PST 2014


Hi list,

I was wondering if you knew a tool that would ensure that tests contain
some kind of assertions e.g., an assert statement or a call to a method
such as TestCase.assertTrue().

I would love to be able to run something like "py.test
--fail-missing-assert" which would fail a test if the user accidentally did
"data == expected_data" rather than "assert data == expected_data".

Tests without any assertions are the worst because the number of tests and
code coverage grows providing a false sense of satisfaction when really the
test would have failed in the first place if a proper assertion was written.

Any thoughts on this?

Thanks,
-- 
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20141114/09e13814/attachment.htm>


More information about the testing-in-python mailing list