unittest-xml-reporting
unittest-based test runner with Ant/JUnit like XML reporting.
What it is and what it does
unittest-xml-reporting is a test runner for Python's built-in unittest framework that captures test results and writes them to XML files in xUnit format. It integrates directly into your test execution pipeline by replacing the default test runner, and outputs structured reports that tools like build systems and continuous integration servers can parse and display. The package depends only on lxml for XML generation.
You use it by instantiating XMLTestRunner in place of the standard unittest runner, pointing it to an output directory or file. It supports command-line discovery and doctest reporting. The XML output follows the xUnit schema, though the package notes that sub-test reporting has limited granularity because xUnit schemas do not map well to unittest's sub-test concept.
Use it for:
- Export unittest results to XML for continuous integration servers to parse and display test metrics.
- Generate structured test reports that build systems and IDEs can consume to show test pass/fail status.
- Run doctests through the test runner to produce xUnit-compatible reports.
- Integrate with Django test runners by setting TEST_RUNNER to the package's Django test runner.
- Capture test results to memory or file for post-processing or archival in automated test pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A unittest test runner that exports test results to XML files in xUnit format, compatible with build systems, IDEs, and continuous integration servers.
Yes. The package is stable (Production/Stable status), has no known vulnerabilities, requires only one lightweight dependency (lxml), and solves a concrete problem—converting unittest results to xUnit XML—that CI/CD pipelines and test aggregators expect. Aging maintenance (219 days since last release) is a minor concern but not a blocker given the package's narrow, mature scope. Install it if you need xUnit-compatible test reports.
Install
unittest-xml-reporting on PyPI
pip
pip install unittest-xml-reportinguv
uv add unittest-xml-reportingpoetry
poetry add unittest-xml-reportingInstalling unittest-xml-reporting
Before you install
Low install friction with a single runtime dependency (lxml). Maintenance status is aging—last release was 219 days ago—but the repository remains active with recent commits and no archived status.
License in practice
BSD-2-Clause is a permissive license; you may use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.
Quickstart
pip install unittest-xml-reporting
import unittest
if __name__ == '__main__':
unittest.main(
testRunner=XMLTestRunner(output='test-reports'),
failfast=False, buffer=False, catchbreak=False)
Requires Python 3.10 or later; lxml is installed as a runtime dependency.
Verify before relying
- Whether the package's limited support for unittest.TestCase.subTest affects your test suite's reporting granularity.
- Compatibility with specific CI/CD systems beyond Jenkins xUnit plugin versions 1.100 and 1.104+.
- Whether the package maintains backward compatibility with older xUnit schemas.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — lxml |
| Maintenance | aging — 219 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,416,842/month — #1,624 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: unittest_xml_reporting-4.0.0-py2.py3-none-any.whl
Keywords: pyunit, unittest, junit xml, xunit, report, testrunner, xmlrunner
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
xmlrunnerA unittest test runner that exports test…
copyleft · top 15,000 on PyPI
xunitparserParses JUnit/XUnit XML test result files and…
permissive · top 15,000 on PyPI
html-testRunnerA unittest test runner that generates…
permissive · top 15,000 on PyPI
junit2htmlConverts JUnit or XUnit XML test result files…
permissive · top 5,000 on PyPI
junitparserParse, create, and manipulate JUnit/xUnit test…
permissive · top 5,000 on PyPI
teamcity-messagesSends test results and build status from Python…
permissive · top 15,000 on PyPI
python-subunitSubunit is a streaming protocol library for…
permissive · top 5,000 on PyPI
junit-xml-2Generates JUnit XML test result reports from…
permissive · top 15,000 on PyPI
colour-runnerAdds colored output to Python's unittest test…
permissive · top 15,000 on PyPI
flake8-formatter-junit-xmlFormats flake8 linting output as JUnit XML,…
permissive · top 15,000 on PyPI