Chapter 8. Extending unittest with nose2

So far we have been using the unittest test runner to run our tests. There are a number of other third-party test runners that have been created by the Python community. One of the most popular ones is nose2. nose2 provides additional features that improve on the default test runner.

Getting started with nose2

Installing nose2 is a breeze. The easiest way to install it is via pip with the following command:

pip install nose2

Let us now run our tests using nose2. From the stock alerter project directory, run the nose2 command (we might have to add it to the path first). nose2 has test autodiscovery by default, so just running the command should give the following output:

............................................................... ...

Get Test-Driven Python Development 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.