3 ms·
I've had pretty bad experiences with mocking frameworks. I try to keep all my tests straight-up python unittests. Forcing yourself to setup and tear down classe
by shanemhansen 13y ago
I've had pretty bad experiences with mocking frameworks. I try to keep all my tests straight-up python unittests. Forcing yourself to setup and tear down classes and their dependencies in a few lines of code while also keeping the ability to swap out dependencies improves my design by an order of magnitude.
I've had projects that were incredibly hard to change due to mocked out database and network dependencies.
That being said, I've occasionally resorted to mock when I'm stuck with crappy code that needs to be put under test before refactoring.
- yeukhon 13y agoI am okay with mock. I was an early adopter of mock so I had the same struggle. Well, I agree there is a big learning curve using mock. When I mock I get lazy I mock a lot of things out. If the project has to spawn processes or do a lot crazy network stuff I just forget about mocking and true unittest. I go straight with functional tests.