Skip to main content

Description

xunitparser reads a JUnit/XUnit XML file and maps it to Python objects. It tries to use the objects available in the standard unittest module.

Usage

import xunitparser
ts, tr = xunitparser.parse(open('/path/to/unit.xml'))

ts is a TestSuite class, containing TestCase classes. tr is a TestResult class.

You can change the classes used (though they probably would not work unless they inherit from the xunitparser ones) by using your own xunitparser.Parser class and changing the *_CLASS variables.

Some helpful properties are added to the TestCase class:

for tc in ts:
    print('Class %s, method %s' % (tc.classname, tc.methodname))
    if tc.good:
        print('went well...', 'but did not run.' if tc.skip else '')
    else:
        print('went wrong.')

For more, please read the source code - it is very minimal. The classes also inherit from the unittest module so it is actually a good reference of what you can do with xunitparser.

Changes

  • 1.3.4

    • fix python 3 compatibility

    • main project URL change as maintainer changes

  • 1.3.0

    • Multiple results in a single TestCase are seen as one. The previous way was never validated by real-life examples.

    • Handle system-out / system-err at the testsuite level

Development

Contributions can be sent to https://gitlab.com/woob/xunitparser/

Release files for xunitparser 1.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xunitparser 1.3.4
File Size Uploaded
xunitparser-1.3.4.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xunitparser 1.3.4
File Interpreter ABI Platform
xunitparser-1.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 20.4 kB

Release files / xunitparser-1.3.4.tar.gz

Download URL xunitparser-1.3.4.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ce6f4319f9a33ddd3ef379109814f9ae2d18921afe9bc0a73caf827362bf8a02
BLAKE2b-256 checksum
How to use checksums
8f8ca46db142d14971a770fd126021194b9c88c92558c23e5911c469bce495e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / xunitparser-1.3.4-py3-none-any.whl

Download URL xunitparser-1.3.4-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20136a960d62c61af4b257f94dd5497da88b4021bb5f017e623fce6379ca972e
BLAKE2b-256 checksum
How to use checksums
e52a6010fbe06d7a32a040eb5d0987a137f3b3b5e8d0792487a29625fb4ba4fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

1.3.4 This release

2 release files

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page