Ejemplo n.º 1
0
 def test_aggregation(self):
     """parallel hook runner should aggregate log of all the failures"""
     runner = parallelhookrunner()
     for i in range(3):
         runner.register(slowfailinghook)
     runner.register(failinghook2)
     runner.evaluate()
     assert len(runner.log.read()) == 4
     assert ERROR_MSG2 in runner.log.read()
Ejemplo n.º 2
0
 def test_correctness(self):
     """parallel hook runner with failing + passing hook
     should return failure"""
     runner = parallelhookrunner()
     for i in range(3):
         runner.register(slowfailinghook)
     for i in range(3):
         runner.register(passinghook)
     assert(runner.evaluate() == False)
Ejemplo n.º 3
0
 def test_speed(self):
     """parallel hook runner should run hooks really in parallel"""
     runner = parallelhookrunner()
     for i in range(100):
         runner.register(slowfailinghook)
     t1 = time.time()
     assert(runner.evaluate()) == False
     t2 = time.time()
     # 100 * 0.1 = 10s if the run was not parallel
     # here we expect less than 0.5s
     assert (t2-t1) < 0.5