Test Overview
This test checks that pytest-cov is correctly set up to measure code coverage during pytest test runs. It verifies that coverage data is collected and reported.
This test checks that pytest-cov is correctly set up to measure code coverage during pytest test runs. It verifies that coverage data is collected and reported.
import pytest def add(a, b): return a + b def test_add(): assert add(2, 3) == 5 # Run this test with coverage using: # pytest --cov=.
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts pytest with coverage option '--cov=.' | Terminal shows pytest starting and coverage plugin initializing | - | PASS |
| 2 | Pytest discovers test_add function and runs it | Test function executes in Python environment | assert add(2, 3) == 5 | PASS |
| 3 | pytest-cov collects coverage data for the add function | Coverage data is recorded in memory | - | PASS |
| 4 | pytest finishes and outputs coverage report to terminal | Terminal displays coverage summary showing 100% coverage for add function | Coverage report shows 100% lines covered | PASS |