Using other add-on test libraries
The
doctest
and unittest
modules allow us to write a number unit tests conveniently. In many cases, we want even more sophistication. One of the more popular additional features is test discovery. The nose
package gives us a way to painlessly examine modules and packages for tests. See http://nose.readthedocs.org/en/latest/ for more information.
There are several benefits of using nose
as an extension to unittest
. The nose
module can collect tests from unittest.TestCase
subclasses, as well as simple test functions, and also from test classes that are not subclasses of unittest.TestCase
. We can use nose
for writing timing tests too—something that can be a little awkward in unittest
.
Because nose
is particularly ...
Get Python Essentials 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.