Test Overview
This test group checks basic math operations: addition and subtraction. It verifies that the functions return correct results.
This test group checks basic math operations: addition and subtraction. It verifies that the functions return correct results.
import pytest class TestMathOperations: def test_addition(self): assert 2 + 3 == 5 def test_subtraction(self): assert 5 - 3 == 2
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | PyTest starts and discovers tests in TestMathOperations class | Test runner ready to execute test_addition and test_subtraction | — | PASS |
| 2 | Runs test_addition method | Executing assertion 2 + 3 == 5 | Check if 2 + 3 equals 5 | PASS |
| 3 | Runs test_subtraction method | Executing assertion 5 - 3 == 2 | Check if 5 - 3 equals 2 | PASS |
| 4 | PyTest finishes running all tests in TestMathOperations | All tests passed | — | PASS |
pytest -m "slow"?
import pytest
@pytest.mark.slow
def test_a():
assert True
@pytest.mark.fast
def test_b():
assert True
class TestGroup:
@pytest.mark.slow
def test_c(self):
assert True
def test_d(self):
assert True
TestMath?
class TestMath:
def test_add():
assert 1 + 1 == 2
def test_subtract(self):
assert 2 - 1 == 1
Pass the test and this pattern moves unknown