Registered 2009-08-01 by Robert Collins

A Python unittest TestResult that outputs JUnit compatible XML.

PyJUnitXML is Copyright (c) 2009 Robert Collins, and distributed under the
GNU Library General Public Licence version 3 (LGPL-3). Broadly, this means you
have the right to use this library in any application you want, regardless of
the licence of your application, but that if you modify this library the
modifications you make need to be released under a compatible terms if you
convey the application to other users. For exact details see the COPYING and
GPL-3 files included in the source.


To use PyJUnitXML you need to specify it as your ``TestResult`` when running
your tests using pyunit. One way of doing this is to invoke the ``test`` method
directly on your test suite::

 >>> import junitxml
 >>> result = junitxml.JUnitXmlResult(sys.stdout)
 >>> result.startTestRun()
 >>> result.stopTestRun()

The ``startTestRun`` and ``stopTestRun`` methods are new in python 2.7 and 3.1.
If you are using older versions of python, and do not invoke the test result
directly, you may find that no output occurs at all. This is likely because the
``stopTestRun`` method is not being invoked, and you will need to arrange for it
to be invoked.


My test runs, but nothing is output? Check that ``result.stopTestRun`` is being
called. Due to the XML file format requiring a header containing the test
counts, nothing is output until the test run has completed, and that is
signalled by the ``stopTestRun`` method being called.

Project information

Part of:
Friends of PyUnit
testtools committers
Not yet selected
Development focus:

trunk series 

Browse the code

Programming Languages:
Version control system:

RDF metadata

View full history Series and milestones

pyjunitxml trunk series is the current focus of development

More contributors Top contributors

All packages Packages in Distributions

All questions Latest questions

Get Involved


Latest version is 0.7
released on 2012-11-18

All downloads