Coverage as a signal, not a goal

P30.pytest-foundations.03 · Audience: guest, it-ml, language-pro · Prerequisites: Fixtures & parametrisation

Real LLM grading for this pageLLM grading (this page):

You can reach 100% coverage without testing anything. Coverage measures which lines ran, never whether you checked what they did - so a suite of assertion-free tests can be green at 100% while the code is silently broken. This short module makes coverage an honest tool: a lower bound that finds untested code, not a target you game.

Step 1 / 3What coverage measures
ⓘ Concept: Lines that ran, not results that were checked
A coverage tool records which lines executed while the tests ran. That is all. A line can run - and count as covered - with nothing asserting the value it produced. So a green 100% only means "no line was entirely skipped"; it is silent on whether the behaviour is correct.

Why it matters — Teams adopt a coverage gate expecting confidence and get a number that a lazy test can satisfy - knowing the difference stops the metric from lying to you.

Ask the mentor about this module

Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.

Ctrl/Cmd + Enter to send

🎓 Practice ladder

2 graded rungs · ~18 min

Your turn: critique a 100%-coverage suite that would pass even if the code were wrong, then step back for the interview question on what makes a whole suite trustworthy.

Rung 1 - critique a 100%-coverage suite that tests nothing (free-form)

Loading exercise…

Interview rung - what makes a test suite trustworthy? (free-form)

Loading exercise…

Coverage is a flashlight, not a finish line: it shows you the corners no test has walked into, and says nothing about whether the room is tidy.