Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    def test_flaky_raises_for_non_positive_min_passes(self):
        with self.assertRaises(ValueError):

            def test_something():
                pass

            flaky(min_passes=0)(test_something)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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),
     )
Ejemplo n.º 5
0
 def test_flaky_raises_for_non_positive_min_passes(self):
     def test_something():
         pass
     self.assertRaises(
         ValueError,
         lambda: flaky(min_passes=0)(test_something),
     )
Ejemplo n.º 6
0
 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)