{"id":6469,"library":"test-results-parser","title":"Test Results Parser","description":"The `test-results-parser` Python library provides functionalities to parse test result files, primarily JUnit XML. It offers two main parsing functions: `parse_junit_xml` for JUnit XML files and `parse_raw_upload` for raw test result uploads. This library is largely written in Rust with Python bindings, focusing on efficient test result processing for integration with platforms like Codecov. The current version is 0.6.1, and its release cadence appears irregular.","status":"active","version":"0.6.1","language":"en","source_language":"en","source_url":"https://github.com/codecov/test-results-parser","tags":["test results","parsing","junit xml","codecov","testing"],"install":[{"cmd":"pip install test-results-parser","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Despite the PyPI package name, the primary module to import for the Codecov implementation of this parser is `testing_result_parsers`.","wrong":"import test_results_parser","symbol":"testing_result_parsers","correct":"import testing_result_parsers"}],"quickstart":{"code":"import testing_result_parsers\nimport os\n\n# Create a dummy JUnit XML file for demonstration\ndummy_junit_xml_content = '''\n<testsuites>\n  <testsuite name=\"my_suite\" tests=\"2\" failures=\"1\" errors=\"0\" skipped=\"0\" time=\"1.5\">\n    <testcase classname=\"my_module.my_class\" name=\"test_success\" time=\"1.0\" />\n    <testcase classname=\"my_module.my_class\" name=\"test_failure\" time=\"0.5\">\n      <failure message=\"Assertion failed: 1 != 2\">Traceback details...</failure>\n    </testcase>\n  </testsuite>\n</testsuites>\n'''\n\nfile_path = \"dummy_junit.xml\"\nwith open(file_path, \"w\") as f:\n    f.write(dummy_junit_xml_content)\n\n# Parse the JUnit XML file\ntest_runs = testing_result_parsers.parse_junit_xml(file_path)\n\nfor run in test_runs:\n    print(f\"Test Name: {run.name}, Outcome: {run.outcome}, Duration: {run.duration}\")\n\n# Clean up the dummy file\nos.remove(file_path)\n","lang":"python","description":"This quickstart demonstrates how to parse a JUnit XML file using `testing_result_parsers.parse_junit_xml`. It creates a dummy XML file, parses it, and then prints the name, outcome, and duration of each test run. The `parse_junit_xml` function returns a list of `Testrun` objects."},"warnings":[{"fix":"Always use `import testing_result_parsers` after installation.","message":"The PyPI package `test-results-parser` imports as `testing_result_parsers`. Using `import test_results_parser` will result in an `ModuleNotFoundError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand the specific scope of this library; if advanced JUnit XML manipulation (e.g., creating, merging, custom elements) is needed, consider `junitparser`.","message":"This library is primarily designed to parse JUnit XML files and raw test result uploads for Codecov. While it offers parsing capabilities, it's not a generic test result manipulation library like `junitparser` which supports creation and merging of XMLs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For development, install `maturin` (`pip install maturin`) and a Rust toolchain, then use `maturin develop`.","message":"As a Rust-backed Python library, development setup (e.g., for contributors) requires `maturin` and a Rust toolchain.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}