Exemple #1
0
 def test_max_runs_no_fail(self):
     flake = Deflake("ls", max_runs=21, quiet=True)
     results = flake.run()
     self.assertEqual(
         len(results), 21,
         "Program should have run 21 times but ran %s" % len(results))
     self.assertTrue(self._results_are_same_and_pass(results))
Exemple #2
0
 def test_continue(self):
     flake = Deflake(os.path.join(self.THIS_DIR, "flaky.sh"),
                     quiet=True,
                     contin=True)
     results = flake.run()
     self.assertEqual(len(results), 10)
     self.assertTrue("FAIL (run 7" in results[6])
Exemple #3
0
 def test_mp(self):
     flake = Deflake("ls", pool_size=4, quiet=True)
     results = flake.run()
     len_results = len(results)
     self.assertEqual(len_results, 10, 
         "Program should have run 10 times, but ran %s" % len_results)
     self.assertTrue(self._results_are_same_and_pass(results))
Exemple #4
0
 def test_default_no_fail(self):
     flake = Deflake("ls", quiet=True)
     results = flake.run()
     self.assertEqual(
         len(results), 10,
         "Program should have run 10 times but ran %s" % len(results))
     self.assertTrue(self._results_are_same_and_pass(results))
Exemple #5
0
 def test_mp(self):
     flake = Deflake("ls", pool_size=4, quiet=True)
     results = flake.run()
     len_results = len(results)
     self.assertEqual(
         len_results, 10,
         "Program should have run 10 times, but ran %s" % len_results)
     self.assertTrue(self._results_are_same_and_pass(results))
Exemple #6
0
def main():
    args = parse_args()
    f = Deflake(args["command"], 
        max_runs=args["max_runs"], 
        pool_size=args["pool_size"],
        counter_token=args["counter_token"],
        quiet=args["quiet"],
        contin=args["continue"]
    )
    results = f.run()

    # 1 exit status if any processes "failed"
    a_fail = [r for r in results if "FAIL" in r]
    sys.exit(1) if len(a_fail) > 0 else sys.exit(0)
Exemple #7
0
 def test_counter_token(self):
     flake = Deflake("touch file#count#.txt", max_runs=2, quiet=True)
     results = flake.run()
     self.assertTrue(
         os.path.exists('file1.txt') and os.path.exists('file2.txt'))
Exemple #8
0
 def test_fail(self):
     flake = Deflake(os.path.join(self.THIS_DIR, "flaky.sh"), quiet=True)
     results = flake.run()
     self.assertEqual(len(results), 7)
     self.assertEqual(results[-1], "FAIL (run 7)\nforced error\n")
Exemple #9
0
 def test_counter_token(self):
     flake = Deflake("touch file#count#.txt", max_runs=2, quiet=True)
     results = flake.run()
     self.assertTrue(os.path.exists('file1.txt') and os.path.exists('file2.txt'))
Exemple #10
0
 def test_continue(self):
     flake = Deflake(os.path.join(self.THIS_DIR, "flaky.sh"), quiet=True, contin=True)
     results = flake.run()
     self.assertEqual(len(results), 10)
     self.assertTrue("FAIL (run 7" in results[6])
Exemple #11
0
 def test_fail(self):
     flake = Deflake(os.path.join(self.THIS_DIR, "flaky.sh"), quiet=True)
     results = flake.run()
     self.assertEqual(len(results), 7)
     self.assertEqual(results[-1], "FAIL (run 7)\nforced error\n")
Exemple #12
0
 def test_max_runs_no_fail(self):
     flake = Deflake("ls", max_runs=21, quiet=True)
     results = flake.run()
     self.assertEqual(len(results), 21, 
         "Program should have run 21 times but ran %s" % len(results))
     self.assertTrue(self._results_are_same_and_pass(results))
Exemple #13
0
 def test_default_no_fail(self):
     flake = Deflake("ls", quiet=True)
     results = flake.run()
     self.assertEqual(len(results), 10,
         "Program should have run 10 times but ran %s" % len(results))
     self.assertTrue(self._results_are_same_and_pass(results))