Skip to main content

Junit-Report

This Python package adds more control to your tests by decorating your functions and pytest fixtures and exporting them as JUnit xml.

Table of contents

Installation

pip install junit-report

Usage

import pytest

from junit_report import JunitTestSuite, JunitTestCase, JunitFixtureTestCase

class TestSomeThing:

    @pytest.fixture
    @JunitFixtureTestCase()
    def my_fixture(self):
        # do stuff ..
        
        @JunitTestCase()
        def nested_case():
          pass
        
        yield nested_case
        
    @JunitTestCase()
    def my_first_test_case(self):
        pass
    
    @JunitTestCase()
    def my_second_test_case(self, name: str):
        raise ValueError(f"Invalid name {name}")
    
    @JunitTestSuite()
    def test_suite(self, my_fixture):
        my_fixture()
        self.my_first_test_case()
        self.my_second_test_case("John")

Output

<?xml version="1.0" ?>
<testsuites disabled="0" errors="0" failures="1" tests="4" time="0.000301361083984375">
	<testsuite disabled="0" errors="0" failures="1" name="TestSomeThing_test_suite" skipped="0" tests="4" time="0.000301361083984375">
		<testcase name="my_fixture" time="0.000163" classname="TestSomeThing" class="fixture"/>
		<testcase name="nested_case" time="0.000034" classname="module_name.test" class="function"/>
		<testcase name="my_first_test_case" time="0.000017" classname="TestSomeThing" class="function"/>
		<testcase name="my_second_test_case" time="0.000087" classname="TestSomeThing" class="function">
			<failure type="ValueError" message="Invalid name John">Traceback (most recent call last): ... ValueError: Invalid name John</failure>
		</testcase>
	</testsuite>
</testsuites>

OS parameters used for configuration

Variable Description
JUNIT_REPORT_DIR Reports directory where the reports will be extracted. If it does not exist - create it.

Metadata

Release files for junit-report 0.2.7

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

Source distribution (sdist)

Source distribution for junit-report 0.2.7
File Size Uploaded Provenance Actions
junit-report-0.2.7.tar.gz 12.1 kB Without provenance Details for junit-report-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for junit-report 0.2.7
File Interpreter ABI Platform Actions
junit_report-0.2.7-py3-none-any.whl Python 3 none any Details for junit_report-0.2.7-py3-none-any.whl

Total release size: 26.1 kB

Release files / junit-report-0.2.7.tar.gz

Download URL junit-report-0.2.7.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8db5f28ea02d70767192e313c501cee7335cea2007386bc9a7f6df77e769f4da
BLAKE2b-256 checksum
How to use checksums
9d35270ff1cb960d079be49c2c82c3d2df2a48b47a917eb3f561688bb7782192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / junit_report-0.2.7-py3-none-any.whl

Download URL junit_report-0.2.7-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35da4506f3ac7f2b8a12341084e69717b2e673b440a3b4e1e5d6828b6a6e64db
BLAKE2b-256 checksum
How to use checksums
3f22cdeccba49ac745ca4a276e38a2314f599fba31348429856a6f1ed5211197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Security for junit-report 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files No provenance

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