Skip to content

junit-xml support #209

@Jongy

Description

@Jongy

Is the --junit-xml pytest flag supported, i.e can I have it include subtests in its report?
It seems that, at least with default settings, subtests are ignored. With pytest 8.3.5 and subtests 0.14.2, for this file:

def test(subtests):
    with subtests.test("test 1"):
        pass

    with subtests.test("test 2"):
        pass

I get this expected pytest verbose output:

tests/test.py::test [test 1] SUBPASS                                                                                                                                                   [100%]
tests/test.py::test [test 2] SUBPASS                                                                                                                                                   [100%]
tests/test.py::test PASSED                                                                                                                                                             [100%]

but this xml:

<testsuites>
<testsuite name="pytest" errors="0" failures="0" skipped="0" tests="3" time="0.034" timestamp="2025-08-25T00:43:19.872314+03:00" hostname="yonatan">
<testcase classname="tests.test" name="test" time="0.022"/>
</testsuite>
</testsuites>

(no mention of the subtests)

Is there any flag to enable it? Or it's just not implemented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions