154: Don't Mock your Database - Jeff Triplett
You need tests for your web app. And it has a database. What do you do with the database during testing? Should you use the real thing? or mock it? Jeff Triplett says don't mock it.
In this episode, we talk with Jeff about testing web applications, specifically Django apps, and of course talk about the downsides of database mocking.
Links:
- "🤔 In ~12 years, I have never seen a case where mocking a database was a good idea. ..."
- Django News
- Moto
- Test & Code 103: Django - Lacey Williams Henschel
- Model Bakery: Smart fixtures for better tests
- Faker
Help support the show AND learn pytest:
- The Complete pytest course is now a bundle, with each part available separately.
- pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.
- Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CI
- Then pytest Booster Rockets can help with advanced parametrization and building plugins.
- Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you.
Creators and Guests

Guest
Jeff Triplett
Jeff Triplett is a Partner at REVSYS and a Director of the Python Software Foundation. The current President and co-founder of the Django Events Foundation North America (DEFNA), the non-profit which has run DjangoCon US since 2015, he was awarded the 2019 Malcolm Tredinnick Memorial Prize for his contributions to the Django community.
