Unit Testing with Pytest
summary
Unit testing with pytest: shows how unit tests provide confidence for refactors and document behavior, demonstrates pytest’s precise failure diffs, and recommends stubbing heavy computations to keep tests fast. Uses concrete examples: a make_adict wrapper around code and a slow son_calculation function replaced with mocker.patch(autospec=True) so only wrapper logic is tested; illustrates fixtures returning Person instances, @pytest.mark.parametrize for multiple scenarios, and test selection using pytest -m / -k plus marking slow tests.
AI-written summary · about
chapters (6)
related talks
27mWhy I use py.test and maybe you should too
21mDon't just test, my friend, test better
32mpytest for unittesters
27mPyTest
38mTesting for the Terrified: How to Write Tests, Conquer Guilt, and Level Up
02h 13mPython Unit Testing with Pytest and Mock
28mEgad! How Do We Start Writing Better Tests?
44mThey are not unit tests: a survey of unit-testing anti-patterns
