{"id":22999,"library":"xunitparser","title":"xunitparser","description":"Read JUnit/XUnit XML files and map them to Python objects. Current version is 1.3.4, with infrequent releases.","status":"active","version":"1.3.4","language":"python","source_language":"en","source_url":"https://github.com/terse/xunitparser","tags":["xunit","junit","xml","testing","parser"],"install":[{"cmd":"pip install xunitparser","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Wrong: Using module-level function without importing explicitly leads to confusion. Correct: from xunitparser import parse","wrong":"import xunitparser; ts, tr = xunitparser.parse(open('file.xml'))","symbol":"parse","correct":"from xunitparser import parse"},{"note":"","wrong":"","symbol":"XmlTestSuite","correct":"from xunitparser import XmlTestSuite"}],"quickstart":{"code":"from xunitparser import parse\nimport sys\n\nwith open('test-results.xml') as f:\n    ts, tr = parse(f)\n    print(f'Testsuite: {ts.name}, tests: {ts.tests}, failures: {ts.failures}, errors: {ts.errors}')\n    for tc in ts:\n        print(f'  Testcase: {tc.methodname} - {tc.result}')","lang":"python","description":"Parse a JUnit XML file and print summary."},"warnings":[{"fix":"Always unpack both: ts, tr = parse(f) even if you don't use tr.","message":"The parse() function returns two values: (testsuite, testresult). The testresult object is often ignored but contains overall counts. Many users forget to unpack both.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the XML file is standard JUnit format. For pytest output, use 'pytest --junitxml=report.xml' and note that xunitparser handles it well.","message":"The library only handles JUnit XML format. Variants from pytest (--junitxml) or other runners may produce slightly different XML that fails to parse.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider alternatives like junitparser or junit-xml if you need active maintenance.","message":"The library has not been updated since 2018. It uses ancient Python idioms and may not support Python 3.10+ fully (though it still works).","severity":"deprecated","affected_versions":"<1.3.4"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Check that the XML file is valid and contains a <testsuite> element. Wrap parse in try-except.","cause":"parse() returned None for testsuite when the XML could not be parsed, or the file was empty.","error":"AttributeError: 'NoneType' object has no attribute 'name'"},{"fix":"Use: from xunitparser import parse","cause":"Using 'xunitparser.parse()' without importing the parse function correctly.","error":"TypeError: 'module' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}