[TIP] Green and Red bars

Alexandre Fayolle alexandre.fayolle at logilab.fr
Thu Oct 21 04:42:59 PDT 2010

On Saturday 09 October 2010 22:37:10 Natalia Bidart wrote:
> Hello List!
> First of all, I'll introduce myself: I'm Natalia, I live in Argentina
> and I've been following the list since PyCon USA 2010. I must confess
> that back then I loved Michael's and Ned's talks, and (mainly) because
> of them I joined the list.
> The reason of my writing is that I'll be giving a talk about Testing
> at PyCon Argentina 2010, which will take place next October 15th and
> 16th, and I need some input from you all. I'm very fond to the concept
> of "getting a green bar" (ergo also to the concept of "red bar"), but
> I'm finding some problems on actually getting a *green* or *red* bar
> using the unittest runner.
> What do I mean? I mean that I want colors! Not because they are nice
> to watch, but because they are a great, easily and understandable
> indicator of how good or bad things are, and because we can easily
> detect whether we're at a point when we need to add some code to make
> a test pass, or even better we're in shape to add another test.
> My test runner of choice is trial mainly because of this, you get a
> lovely visual verdict when running the test suite. But since I'm
> giving this talk to potential newbies on testing, I would like to
> stick to showing/using only unittest (and unittest2), and to not
> depend on trial (though I will mention/recommend it at the end).
> Summing up: is there any way of getting green/red bars using unittest?

The original pyunit shipped with a tkinter gui (unittestgui) with the 
green/red bar. It has not made it to the standard library, but is still 
available in the python-unit package in Debian. 

See http://pyunit.sourceforge.net/ for sourcecode, screenshots, etc. 

Porting to unittest2 should not be too complicated. 

Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, CubicWeb, Debian :  http://www.logilab.fr/formations
Développement logiciel sur mesure :      http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science

More information about the testing-in-python mailing list