-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
plugin: junitxmlrelated to the junitxml builtin pluginrelated to the junitxml builtin pluginplugin: subtestsrelated to the subtests builtin pluginrelated to the subtests builtin plugin
Description
Testing with tip-of-main to try out new subtests integration. Simple subtest example
def test_subtests(subtests):
"""Simple subtest example"""
for i in range(2):
with subtests.test(msg="is_even", i=i):
assert i % 2 == 0, f"{i} is odd"
I expect each subtest to appear as a in a generated JUnit XML. Instead, only the top level is:
<testcase classname="samples.test_sample" name="test_subtests" time="0.006">
<failure message="AssertionError: 1 is odd assert (1 % 2) == 0">subtests = <_pytest.subtests.Subtests object at 0x103b1d580>
def test_subtests(subtests):
"""Simple subtest example"""
for i in range(2):
with subtests.test(msg="is_even", i=i):
> assert i % 2 == 0, f"{i} is odd"
E AssertionError: 1 is odd
E assert (1 % 2) == 0
samples/test_sample.py:87: AssertionError</failure><system-out>--------------------------------- Captured Log ---------------------------------
</system-out>
<failure message="contains 1 failed subtest">contains 1 failed subtest</failure>
<system-out>--------------------------------- Captured Log ---------------------------------
</system-out>
</testcase>
- a detailed description of the bug or problem you are having
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
Metadata
Metadata
Assignees
Labels
plugin: junitxmlrelated to the junitxml builtin pluginrelated to the junitxml builtin pluginplugin: subtestsrelated to the subtests builtin pluginrelated to the subtests builtin plugin