The tests pass, but the first one is never run because its name is redefined. This
clearly shows up as a non-run test in the coverage report. In this
case, we only need to rename one of them,
and both are covered and pass.
But sometimes there’s a bug in the test
which would cause it to fail, but we just don’t know because it’s not run.
Tip 2:pytest’s parametrize is a
great way to combine similar test functions with different input data.
It’s not so obvious when looking at the code, but Codecov highlights a problem:
The append_images generator is being consumed inside roundtrip(), so we have nothing
to iterate over in the for loop – hence no coverage. The
fix is to
use a list instead of a generator.