[TIP] unittest2 xml output / integration with Jenkins/Hudson

Michael Foord michael at voidspace.org.uk
Fri Jul 22 04:30:47 PDT 2011


On 22/07/2011 04:18, Duncan Findlay wrote:
> On Jul 19, 2011, at 10:25 PM, Robert Collins wrote:
>
>> On Wed, Jul 20, 2011 at 4:11 PM, Duncan Findlay<duncan at duncf.ca>  wrote:
>>> Hi all,
>>>
>>> I've got a bunch of unit tests written with unittest2 (Python 2.4 and 2.6) and I want to set up Jenkins to display unit tests status. I'm looking for something "production-ready" (for some definition thereof) that will allow me to discover and run unit tests with XML output.
>>>
>>> I have been using the unittest2 plugins branch, but that's not "production ready" (I had to patch it to get it to run). It seems like many of the other common solutions (e.g. nose) don't like it when test cases are subclasses of unittest2.TestCase instead of unittest.TestCase.
>>>
>>> I'm sure I'm not the only one trying to do something like this. What's everyone else doing?
>>>
>> I wrote http://pypi.python.org/pypi/junitxml specifically for this use
>> case. Its used by (amongst others) the drizzle project for hudson
>> integration.
> Great, thanks!
>
> I took a look today and it seems to do most of what I want, although I was hoping for something closer to a drop in replacement for "unit2 discover". I'll see if I can build on it and maybe contribute a patch or two.
The unit2 script itself is very simple (well, unittest2.main.main_ 
really). All the work of discovery is done in TestLoader.discover.

Writing a wrapper script that does the same as unit2 but uses pyjunitxml 
should be very easy.

Michael

> Duncan
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python


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

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html




More information about the testing-in-python mailing list