Test Overview
This test package contains two simple test files. It verifies that pytest can discover and run tests across multiple files inside a package.
This test package contains two simple test files. It verifies that pytest can discover and run tests across multiple files inside a package.
import pytest # File: tests/test_math.py def test_addition(): assert 1 + 1 == 2 def test_subtraction(): assert 5 - 3 == 2 # File: tests/test_strings.py def test_uppercase(): assert 'hello'.upper() == 'HELLO' def test_isdigit(): assert '1234'.isdigit() == True # To run tests, execute: pytest tests/
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts and looks for tests in the 'tests' package | Pytest scans the 'tests' directory and finds test_math.py and test_strings.py | - | PASS |
| 2 | Pytest loads test_math.py and runs test_addition | Running test_addition function | Assert 1 + 1 == 2 | PASS |
| 3 | Pytest runs test_subtraction in test_math.py | Running test_subtraction function | Assert 5 - 3 == 2 | PASS |
| 4 | Pytest loads test_strings.py and runs test_uppercase | Running test_uppercase function | Assert 'hello'.upper() == 'HELLO' | PASS |
| 5 | Pytest runs test_isdigit in test_strings.py | Running test_isdigit function | Assert '1234'.isdigit() == True | PASS |
| 6 | Pytest finishes running all tests and reports results | All 4 tests passed | - | PASS |