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:
............................................................... ---------------------------------------------------------------------- Ran 63 tests in 0.109s OK
As we can see, the nose2
command gives the same output as unittest
. nose2 which also discovered the same tests and ran them. By default, nose2 autodiscover patterns are compatible with unittest
, so we can just drop in nose2 as a replacement runner without changing any code.