We have seen how a test suite, to be reasonably reliable, should include various kinds of tests that cover components at various levels. Usually, tests, in regard to how many components they involve, are categorized into at least three kinds: unit, integration, and end-to-end.
Test doubles ease the implementation of tests by breaking dependencies between components and allowing us to simulate the behaviors we want.
In this chapter, we will look at the most common kinds of test doubles, what their goals are, and how to use them in real code. By the end of this chapter, we will have covered how to use all those test doubles and you will be able to leverage them for your own Python projects.
By adding test doubles to your toolchain, you will be able to write faster tests, decouple the components you want to test from the rest of the system, simulate...