A Sixth Seam in TDD? - Python Testing, Test Doubles & Legacy Code at Kosli
summary
Proposes a new test double called an auto cache that Kosli uses to speed and stabilise Python tests by replaying seam interactions from disk. Implements it as a pytest autouse fixture that yields a T object with a test ID, proxies seam calls, and either replays from pickle files or rebuilds and populates the cache. Uses runtime‑failures to rerun flaky cases; first run often populates the cache, second run reliably replays, cutting CI time.
AI-written summary · about
chapters (11)
- 0:00Introduction and talk title correction
- 0:21Dylan Thomas reference and personal intro
- 0:59The idea: caching at seams in test code
- 1:14What is a seam? (Michael Feathers definition)
- 1:50Test doubles overview: dummy, stub, spy, mock, fake
- 2:38The sixth seam: auto cache concept
- 3:00Python implementation at Kosli
- 3:44pytest fixture with autouse
- 4:26Using the cache at the seam
- 4:47Replay vs rebuild logic
- 5:05Handling flaky tests with runtime-failures
related talks
21mDon't just test, my friend, test better
37mTDD - the why, the how and the when not
27mFake Your Test Away: How To Abuse Your Test Doubles
41mTDD for APIs
48mA Reflection on Software Testing
26mMashing up py.test, coverage.py and ast.py to take TDD to a new level
27mHow a Solo Hobbyist Learned to Love Testing
27mI Dance with Your Shadow: Patch, Stub, Mock
