PyJUnitXML
A Python unittest TestResult that outputs JUnit compatible XML.
Copyright
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.
Usage
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() >>> suite.run(result) >>> 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.
There is a command line runner you can use:
$ python -m junitxml.main discover
or
$ junitxml discover
If the package scripts have been installed.
Troubleshooting
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.
Reporting Bugs and Asking Questions
PyJUnitXML is hosted on Launchpad at https://launchpad.net/pyjunitxml. Please file bugs, ask questions and so on at will.
Running PyJUnitXML’s test suite
The function junitxml.test_suite defines the junitxml test suite, you can use any runner you like. I personally use:
$ python -m subunit.run junitxml.test_suite | subunit2gtk
If you have testrepository you can simply run testr:
$ testr run
Enjoy, Rob Collins
Metadata
Release files for junitxml 0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| junitxml-0.7.tar.gz | 26.0 kB | Without provenance | Details for junitxml-0.7.tar.gz |
Release files / junitxml-0.7.tar.gz
| Download URL | junitxml-0.7.tar.gz |
|---|---|
| Size | 26.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5901127067ab7f3d11df30727368c129c69b3f5595c697daf4f5ed80b1baaa3
|
|
BLAKE2b-256 checksum How to use checksums |
86dfbdf6f8d13a62b7e70fe16f93158fef72322d74d771438ae5b5931f2d33b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for junitxml 0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.