'A @flaky test that fails sometimes and succeeds other times counts as a
pass, as long as it passes more than the given min_passes threshold.'

@given(permutations([(lambda : throw(ValueError('failure'))), (lambda : None), (lambda : throw(RuntimeError('failure    #2')))]))
def test_intermittent_flaky_test(self, test_methods):

    executions = iter(test_methods)
    class SomeTest(testtools.TestCase, ):
        run_tests_with = retry_flaky()
        @flaky(u'FLOC-XXXX', max_runs=len(test_methods), min_passes=1)
        def test_something(self):
            next(executions)()
    test = SomeTest('test_something')
    self.assertThat(run_test(test), has_results(tests_run=Equals(1)))
