Nosetests with nice output

We are using nosetests for tests. Its basic output is quite simple:

pi@raspberrypi ~/workspace/lcdmanager $ nosetests
................................
----------------------------------------------------------------------
Ran 32 tests in 1.859s

OK

Only dots without any usefully information. If we use -v switch, we improve output:

pi@raspberrypi ~/workspace/lcdmanager $ ./tests
...
test_pane.TestPane.test_add_widget ... ok
test_pane.TestPane.test_correct_init ... ok
test_pane.TestPane.test_it_should_render_widget_from_top ... ok
test_pane.TestPane.test_it_should_render_widget_two_labels ... ok
test_pane.TestPane.test_should_get_widget_by_name ... ok
...

Much better, we can see more details. But output can be much better.

I installed Spec extension for nosetests. Its easy to install:


sudo pip install spec

Now when we run:


nosetests --with-specplugin

We have very nice output:


...
Pane
- add widget
- correct init
- it should render widget from top
- it should render widget two labels
- should get widget by name
...

Output is much better and more user friendly. It also force us to use better test names 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s