Chapter 14. Fit and Finish – Unit Testing, Packaging, and Documentation
Beyond the Python language and its libraries, there are several other aspects to Python programming. We'll start by looking closely at the docstrings, which should be viewed as an essential ingredient in every package, module, class, and function definition. These have several purposes, one of which is to clarify what the object does.
In this chapter, we'll also look at the different approaches to unit testing. The doctest
and unittest
modules provide a comprehensive suite of tools. External tools like Nose are also widely used.
We'll also look at how we can leverage the logging
module as part of a complete application. The Python logger is quite sophisticated as well, so we'll focus on a few of the essential features.
We'll examine some tools that are used to build Python documentation from the embedded docstring comments. Using tools to extract documentation allows us to focus...