pytest
pytest copied to clipboard
subtests not itemized in Junit XML
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
<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>
- [x] a detailed description of the bug or problem you are having
- [ ] output of
pip listfrom the virtual environment you are using - [x] pytest and operating system versions
- [x] minimal example if possible