"WHAT IS THIS MESS?" - Writing tests for pre-existing code bases
summary
Practical steps for putting tests around messy, untested Python: pick concrete tools (pytest, pytest-django, pytest-cov, pytest-socket, factory-boy), write a failing test for current behavior then for the desired change, and prefer integration tests when endpoints mask model behavior (example: quark model, He-Man/Skeletor bug). Break external dependencies via subclassing, patching or injectable SMTP, measure progress with coverage reports, and add CI so builds fail on regressions — small, incremental, verifiable changes.
AI-written summary · about
chapters (11)
- 0:00Start
- 1:25What Is Legacy Code?
- 2:23Why SHOULDN'T We?
- 4:43Test What You Touch
- 5:48Choose Thy Weapons
- 7:37Assignment 1
- 11:30MY MAGIC PROPERTY
- 16:09Breaking Dependencies
- 16:43Assignment 2
- 24:51Are We Making Progress
- 25:54Create A Legacy
related talks
38mTesting for the Terrified: How to Write Tests, Conquer Guilt, and Level Up
28mEgad! How Do We Start Writing Better Tests?
23mThe Unspeakable Horror of Discovering You Didn't Write Tests
35mTurning test writing into a consistently brief and pleasant experience
29mEgad! How Do We Start Writing (Better) Tests?
21mDon't just test, my friend, test better
17mTest! (Some OF) Your! Code!: How To Write...
42mManaging technical debt in (Django) Projects
