[TIP] Green and Red bars

Michael Foord fuzzyman at voidspace.org.uk
Tue Oct 12 05:17:41 PDT 2010

  On 09/10/2010 21:37, 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.

It would be very easy to implement with unittest2, but it would mean 
replacing the standard "unit2" test runner script (and a little GUI 
chops to create a green / red style progress bar). You would only need 
to provide a custom result class that fed pass / fail to the UI (plus 
the total number of tests on test run start).

With unittest2 plugins it would be even easier and would work with the 
default test runner.

It sounds like you have lots of options though, so implementing 
something custom is probably not ideal... :-)

All the best,

> 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?
> Thanks!
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python



READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.

More information about the testing-in-python mailing list