

def test_max_attempt_reached_not_raised_for_multiple_runs(self, sleep_mock):
    predicate = mock.Mock()

    @retrying.retry(max_attempts=2, predicate=predicate)
    def foo():
        return 'fake'
    for _ in range(5):
        predicate.side_effect = (False, True)
        sleep_mock.reset_mock()
        self.assertEqual('fake', foo())
        self.assertCalledOnce(sleep_mock)

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/tests/lib/utils/test_retrying.py RetryTestCase.test_max_attempt_reached_not_raised_for_multiple_runs/original