Summary
We have finally covered the most important topic in Python programming: automated testing. Test-driven development is considered a best practice. The standard library unittest
module provides a great out-of-the-box solution for testing, while the pytest
framework has some more Pythonic syntaxes. Mocks can be used to emulate complex classes in our tests. Code coverage gives us an estimate of how much of our code is being run by our tests, but it does not tell us that we have tested the right things.
In the next chapter, we'll jump into a completely different topic: concurrency.