[TIP] Green and Red bars
nataliabidart at gmail.com
Tue Nov 16 12:20:48 PST 2010
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.
* 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!
More information about the testing-in-python