def test_flaky_raises_for_max_runs_less_than_min_passes(self): with self.assertRaises(ValueError): def test_something(): pass flaky(max_runs=2, min_passes=3)(test_something)
def test_flaky_raises_for_non_positive_min_passes(self): with self.assertRaises(ValueError): def test_something(): pass flaky(min_passes=0)(test_something)
def _expect_test_flaky(self, is_test_method, max_runs, min_passes): self._expect_call_test_address() if is_test_method: for flaky_attr in FlakyNames(): setattr(self._mock_test, flaky_attr, None) mock_test_method = getattr(self._mock_test, self._mock_test_method_name) flaky(max_runs, min_passes)(mock_test_method) else: flaky(max_runs, min_passes)(self._mock_test) mock_test_method = getattr(self._mock_test, self._mock_test_method_name) for flaky_attr in FlakyNames(): setattr(mock_test_method, flaky_attr, None)
def test_flaky_raises_for_max_runs_less_than_min_passes(self): def test_something(): pass self.assertRaises( ValueError, lambda: flaky(max_runs=2, min_passes=3)(test_something), )
def test_flaky_raises_for_non_positive_min_passes(self): def test_something(): pass self.assertRaises( ValueError, lambda: flaky(min_passes=0)(test_something), )
def _expect_test_flaky(self, is_test_method, max_runs, min_passes): self._expect_call_test_address() if is_test_method: for flaky_attr in FlakyNames(): setattr(self._mock_test, flaky_attr, None) mock_test_method = getattr( self._mock_test, self._mock_test_method_name ) flaky(max_runs, min_passes)(mock_test_method) else: flaky(max_runs, min_passes)(self._mock_test) mock_test_method = getattr( self._mock_test, self._mock_test_method_name ) for flaky_attr in FlakyNames(): setattr(mock_test_method, flaky_attr, None)