How I migrated a huge OSS project to use pytest
summary
A Python script performs syntax-aware automated refactors with Bowler to convert GDAL’s old test framework to pytest, producing a final pull request of 118,000 lines. Specific wins include removing ~9,000 lines for pointless return-style failures, renaming thousands of tests, inserting pytest fixtures, and replacing custom asserts so pytest shows useful diffs. A bash orchestrator replays automated commits separately from manual fixes to avoid merge conflicts. The work runs, lands, and gets merged.
AI-written summary · about
chapters (33)
- 0:00Introduction
- 0:42My dream job
- 1:00GIS data
- 1:18Code formatting
- 2:51What is pytest
- 4:05Refactoring with the standard library
- 4:29bola
- 5:30GDL
- 6:03Why do they need refactoring
- 7:23Running individual tests
- 8:18GDL tests
- 11:19pytest fixtures
- 13:40Syntax aware refactoring
- 18:04Testing logic
- 18:28Saving code
- 18:46My wife didnt like it
- 19:24GTL kept going
- 20:05Conflicts
- 20:19Manual vs automated
- 20:43Rebasing
- 21:10Resolving conflicts
- 21:55Writing a script
- 22:53Committing changes
- 23:04Manual commits
- 23:19Script
- 24:12Should you do it
- 25:24Line chain changes
- 25:38Automation
- 25:57Commit history
- 26:41Be polite and humble
- 27:18Leave out controversial stuff
- 27:35The little things
- 28:02Thanks
related talks
19mHow I auto-refactored GDAL's test suite
29mAdopt-a-pytest
26mThe realities of open source testing: lessons learned from “Adopt pytest month”
28mEgad! How Do We Start Writing Better Tests?
52mScaling the Security Researcher to Eliminate OSS Vulnerabilities Once and for...
29mEgad! How Do We Start Writing (Better) Tests?
32mpytest for unittesters
38mTesting for the Terrified: How to Write Tests, Conquer Guilt, and Level Up
