Skip to content

Tests with failed subtests are not rerun #315

@henzef

Description

@henzef

Hi all,
The freshly released pytest 9.0 comes with the new "subtests" fixture, with which I played around a bit. I would have expected the rerunfailures plugin to handle a test with failed subtests as failed and therefore trigger a rerun, but it doesn't. Is this intended behaviour or just not supported yet?

I can reproduce this issue with pytest 9.0 or with pytest 8.2 + pytest-subtests plugin.

Example code:

counter1 = 0
counter2 = 0

def test_not_working(subtests):
    global counter1

    counter1 += 1
    with subtests.test():
        assert counter1 > 1, "If this test was rerun, this would succeed"


def test_working():
    global counter2

    counter2 += 1
    assert counter2 > 1, "If this test was rerun, this would succeed"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions