Misunderstanding Code Coverage

I’m trying to make sense of code coverage. I installed pytest-cov. I have no idea of what I’m doing: This is the result.

coverage report -m scannerex32.py test_scannerex32.py 
Name                  Stmts   Miss  Cover   Missing
scannerex32.py           52     41    21%   5-7, 10, 15-19, 22-31, 34-44, 47-50, 55-62, 66
test_scannerex32.py      19     19     0%   1-41
TOTAL                    71     60    15%

And then I switched the order of the arguments (script names).

 coverage report -m test_scannerex32.py scannerex32.py 
Name                  Stmts   Miss  Cover   Missing
scannerex32.py           52      2    96%   43, 50
test_scannerex32.py      19      0   100%
TOTAL                    71      2    97%

What is going on here? What tutorial/documentation should I be reading to make sense of this report? I’ve read parts of the docs:

That’s the most helpful documentation I’ve found so far.

I think I understand the second report. The missing lines are catch-all cases. That’s good, right?

But what did I do wrong in the first run and report? Nothing about the scripts changed between runs/reports.

There’s also an HTML view that will show you all the lines that are covered or not as actual code. I believe I show this in the video, but look for html output options. It’s really the only way to see what’s going on. Also keep in mind that coverage is just a sanity check. It’s not saying you’ve perfectly tested the thing if you hit 100%, but more that you reached a bare minimum. Without coverage you could be testing the same 10% of the code 90 times and have no idea. You also need to incorporate some thought into edge cases to handle and other things that coverage doesn’t quite show, but at least having a high amount of coverage will save your bacon when you make later changes.