~/talk

Stop Using Mocks (for a while)

Talkat PyCon US 2020 · 2020-04-15..04-23· [testing]
slides:none on file

The claim is blunt: stop using mocks for a while and instead build an adapter, inject it, and use a small in‑memory fake or integration tests. Concrete tools: an adapter class that hides requests, a fake cargo API backed by a dict, dependency injection instead of mock.patch, sandbox or a local fake container, and VCR.py for recordings. Before this change a feature spawns ~12 tests with 5–6 mocks each; after it yields Functional Core, Imperative Shell, clearer tests, Dependency Injection and hand-rolled fakes that actually work and reduce brittleness.

AI-written summary · about

  1. 0:00Introduction
  2. 0:57The Heros Journey
  3. 4:11Example Code
  4. 8:40Sync to API
  5. 12:25Mocks are Broken
  6. 16:56Adapter Example
  7. 22:10Build a Fake
  8. 27:08Dependency Injection
  9. 33:32Wrapping Up
  10. 37:25Building a Fake API
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.