Python Mock Pitfall: Patch Where It Is Used, Not Where It Is Defined
📰 Dev.to · Recca Tsai
The most common Python mock mistake: patching utils.sum when the test still runs the real function. When you do `from utils import sum`, the importing module gets its own binding. Patch the importing module's namespace, not the original definition.
DeepCamp AI