Test Overview
This test checks a simple function using PyTest framework. It verifies that the function returns the expected result. This helps compare how PyTest runs tests versus unittest and nose.
This test checks a simple function using PyTest framework. It verifies that the function returns the expected result. This helps compare how PyTest runs tests versus unittest and nose.
import pytest def add(a, b): return a + b def test_add(): assert add(2, 3) == 5
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | PyTest test runner initializes | - | PASS |
| 2 | PyTest collects test functions starting with 'test_' | Test function 'test_add' found | - | PASS |
| 3 | PyTest runs test_add function | Function add(2, 3) is called | Check if add(2, 3) == 5 | PASS |
| 4 | Assertion passes as 2 + 3 equals 5 | Test completes successfully | assert add(2, 3) == 5 | PASS |
| 5 | Test ends and report shows 1 test passed | Test summary displayed | - | PASS |