Test Overview
This test checks if pytest correctly reads configuration from pyproject.toml to set test markers and options. It verifies that a test marked as smoke runs and passes.
This test checks if pytest correctly reads configuration from pyproject.toml to set test markers and options. It verifies that a test marked as smoke runs and passes.
import pytest @pytest.mark.smoke def test_example(): assert 1 + 1 == 2 # Run command: # pytest -m smoke # pyproject.toml content: # [tool.pytest.ini_options] # markers = ["smoke: mark test as smoke test"] # addopts = "-m smoke"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts pytest | pytest reads pyproject.toml configuration file | - | PASS |
| 2 | pytest applies ini_options from pyproject.toml, enabling 'smoke' marker and '-m smoke' option | pytest is configured to run only tests marked with 'smoke' | - | PASS |
| 3 | pytest discovers test_example function | test_example is marked as 'smoke' | - | PASS |
| 4 | pytest runs test_example | test_example executes assert 1 + 1 == 2 | assert 2 == 2 | PASS |
| 5 | pytest reports test_example passed with 'smoke' marker | Test report shows 1 passed test with smoke marker | test count and marker correctness | PASS |