Martin Fowler said so
Prove to myself that the code works
Alert me if something breaks in the future
Comfortably make future changes
A gift to future developers
it's hard / intimidating
it takes too long
it doesn't benefit me
my code is always perfect
failing tests + CI = embarrassment
'mock' library is the most popular
'pip install mock' in python 2
built into python 3
Well documented... but not straight forward
Github README
requirements.txt
Web app
for i in {1..10}; do
pytest tests/test_mocking_bird.py
done | grep seconds
Run tests even if the API is not available
Test the rare edge cases
Tests run quickly even if the real interface is slow
Test interactions with interfaces that have no return value