Pytest: Mocking - why?
- Testing environment that does not depend on external systems.
- Faster tests (mock remote calls, mock whole databases, etc.)
- Fake some code/application/API that does not exist yet.
- Test error conditions in a system not under our control.
- TDD, unit tests
- Spaghetti code
- Simulate hard to replicate cases
- 3rd party APIs or applications