[TIP] Green and Red bars

Michael Foord fuzzyman at voidspace.org.uk
Wed Nov 17 06:53:40 PST 2010


On 16/11/2010 20:20, Natalia Bidart wrote:
> Hello list!
>
> It took me a while to catch up with this but here I go.
>
> On Tue, Oct 12, 2010 at 8:17 AM, Michael Foord
> <fuzzyman at voidspace.org.uk>  wrote:
>>   On 09/10/2010 21:37, Natalia Bidart wrote:
>>> 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... :-)
> Yes, I've got plenty options, and I showed them all in a lightning
> talk I gave about test runners at PyCon Ar 2010.
>
> Sadly, none of them provide my (ideal) test runner: a CLI colored
> per-test output that accepts/handles unittest decorators.

Sorry, when you originally specified that you wanted a red / green bar I 
didn't realise you meant via the CLI rather than a GUI.

It should be easy to do once the unittest2 plugins are stabilised but 
first I have a whole bunch of fixes I need / want to do to vanilla 
unittest(2).

All the best,

Michael

> * unit2 is colorless
> * nose with rudolf will not provide a per test colored result
> * py.test will no handle unittest skip/expectedFailure decorators
> * trial won't handle the expectedFailure decorator (fails with
> TypeError: addExpectedFailure() takes exactly 4 arguments (3 given))
>
> So, I think I should try to add the coloured output option to unit2 as
> a plugin. I'm not sure when I'll be able to do this in the short term,
> but if I am, I'll let you all know.
>
> Thanks a lot for all the answers!
>
> Cheers, Natalia.


-- 
http://www.voidspace.org.uk/




More information about the testing-in-python mailing list