Introduction
IF YOU HAVE picked up this book, you clearly have some interest in the world of Python. Perhaps you have just started to learn the language. Maybe you have some Python experience and are looking to learn more about the world of testing. You also could have many years of Python under your belt and want to refresh your testing skills. Whatever your reasons, you will pick up some new skills.
The book covers testing right through from its history looking at how testing in Python has evolved over the years to where it is now, and a brief look at the different practices used. You also look at reasons for testing and why it can be so important in both large enterprise class projects and in small personal projects.
The book lets you get your hands dirty with the basic building blocks in testing, which are unit tests. Here you will be taken through what a unit test is, the basic syntax, and examples of a simple unit test. Then, you take a comprehensive look at the methods available to use in unit testing and the various tools available to help in running and debugging your tests. Wrapping up the unit test section, you look into the pivotal use of mocks and patching, which allow you to isolate the code you are interested in testing (your “units”), and simulate responses from other parts of the system or libraries.
Testing in your documentation is one of the more interesting parts of Python testing. This section shows you how to effectively embed unit tests in your doc strings ...
Get Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.