~/talk

I Dance with Your Shadow: Patch, Stub, Mock

TalkinSpanishat PyCon US 2022 · 2022-04-27..05-03· [testing, python]
slides:none on file

Shows concrete Python testing techniques: how to patch the import location to replace objects in the runtime namespace, when to prefer dependency injection over patching, and the differences between Mock and MagicMock (including autospec and wrapper usage). Demonstrates asserting call patterns and return sequences, and tools for external interactions such as vcr‑pytest to record HTTP interactions and moto to fake AWS; reports benefits for CI speed and cost and warns about re‑recording and stale cassette risks.

AI-written summary · about

  1. 0:00Introduction
  2. 4:22Simulators
  3. 6:00Patching - Common Mistakes
  4. 8:02Patching - Decorator
  5. 9:15Patching - Context Manager
  6. 10:38Patching - Scopes
  7. 12:30Dependency Inversion
  8. 15:54Mocks - Specs
  9. 17:52Mock - Assertions
  10. 19:07VCR - A Recorder
~/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.