Skip to content Skip to sidebar Skip to footer

Can Pytest Be Made To Fail If Nothing Is Asserted?

Today I had a failing test that happily succeeded, because I forgot a rather important line at the end: assert actual == expected I would like to have the machine catch this mista

Solution 1:

This is one of the reasons why it really helps to write a failing test before writing the code to make the test pass. It's that one little extra sanity check for your code.

Also, the first time your test passes without actually writing the code to make it pass is a nice double-take moment too.

Post a Comment for "Can Pytest Be Made To Fail If Nothing Is Asserted?"