Month: December 2015

LCD Manger – part 6: Pane’s width and height

Lets move on with our pane widget. We will fix width and height calculation.

Download source.

(more…)

Advertisements

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 🙂