I would like to store that specific tests failed, then pass that info via API when test class is finished.
I tried sth like that:
fails = []
@pytest.fixture(scope='function')
def something(request):
yield
if request.session.testsfailed:
print("I failed")
fails.append(request.node.name)
print('FAILED', fails)
class TestLala:
@pytest.mark.order(1)
def test_test1(self, something):
assert False
@pytest.mark.order(3)
def test_test1(self, something):
assert True
@pytest.mark.order(3)
def test_test3(self, something):
assert 4 == 4
but instead of failed tests I am still getting each test name added to the list.