Explore a thought-provoking talk from PyCon US that challenges the conventional use of mocks in testing. Discover why classic testing approaches often fall short in real-world scenarios and learn alternative strategies for designing more maintainable and effective tests. Delve into patterns like "Functional Core, Imperative Shell" and Dependency Injection, and understand how hand-rolled fakes can serve as a superior alternative to mocking and patching. Gain insights on improving code design, creating more robust test suites, and achieving a healthy test pyramid. Through practical examples and a journey from sync APIs to building fake APIs, acquire valuable techniques to enhance your testing practices and overall code quality.
Overview
Syllabus
Introduction
The Heros Journey
Example Code
Sync to API
Mocks are Broken
Adapter Example
Build a Fake
Dependency Injection
Wrapping Up
Building a Fake API
Taught by
PyCon US