Chapter 13. Testing Object-oriented Programs
Skilled Python programmers agree that testing is one of the most important aspects of software development. Even though this chapter is placed near the end of the module, it is not an afterthought; everything we have studied so far will help us when writing tests. We'll be studying:
- The importance of unit testing and test-driven development
- The standard
unittest
module - The
py.test
automated testing suite - The
mock
module - Code coverage
- Cross-platform testing with
tox
Why test?
A large collection of programmers already know how important it is to test their code. If you're among them, feel free to skim this section. You'll find the next section—where we actually see how to do the tests in Python—much more scintillating. If you're not convinced of the importance of testing, I promise that your code is broken, you just don't know it. Read on!
Some people argue that testing is more important in Python code because...