Notes from Python Testing with pytest by Brian Okken.
- ch_2 - Writing Test Functions
- Structuring Test Functions
- Grouping Tests with Classes
- Running a Subset of Tests
- ch_3 - pytest Fixtures
- Setup / Teardown
- Tracing Fixture execution
- Fixture Scope
- Sharing Fixtures through
conftest.py
autouse
- ch_4 - Builtin Fixtures
tmp_path
andtmp_path_factory
capsys
monkeypatch
- ch_5 - Parametrization
- Parametrizing Functions
- Parametrizing Fixtures
- Parametrizing with
pytest_generate_tests
- ch_6 - Markers
- Builting Markers
- Skipping Tests with
pytest.mark.skip
- Skipping Tests conditionally with
pytest.mark.skipif
- Expecting Tests to Fail with
pytest.mark.fail
- Selecting Tests with Custom Markers
- Marking Files, Classes and Parameters
- ch_7 - Strategy
- ch_8 - Configuration Files
pytest.ini
tox.ini
pyproject.toml
setup.cfg
- Root Directory and config file
- ch_9 - Coverage
pytest-cov
- ch_10 - Mocking
- Mocking an Attribute
- Mocking a Class and Methods
- Keeping Mock and Implementation in Sync with Autospec