Install & Compatibility
Where this runs
tested against v1.3.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.198s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.154s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
parse
✓ from xunitparser import parse
✗ import xunitparser; ts, tr = xunitparser.parse(open('file.xml'))
Wrong: Using module-level function without importing explicitly leads to confusion. Correct: from xunitparser import parse
XmlTestSuite
✓ from xunitparser import XmlTestSuite
Parse a JUnit XML file and print summary.
from xunitparser import parse
import sys
with open('test-results.xml') as f:
ts, tr = parse(f)
print(f'Testsuite: {ts.name}, tests: {ts.tests}, failures: {ts.failures}, errors: {ts.errors}')
for tc in ts:
print(f' Testcase: {tc.methodname} - {tc.result}')
Errors
Common errors & fixes
AttributeError: 'NoneType' object has no attribute 'name'
parse() returned None for testsuite when the XML could not be parsed, or the file was empty.
fixCheck that the XML file is valid and contains a <testsuite> element. Wrap parse in try-except.
TypeError: 'module' object is not callable
Using 'xunitparser.parse()' without importing the parse function correctly.
fixUse: from xunitparser import parse
Upgrade
Version history
1.3.4latest on PyPI · released Feb 23, 2022
Audit
Dependencies
No dependency data recorded yet.