Beispiel #1
0
 def test_priority(self):
     processes = []
     t1 = time.time_ns()
     processes.append(create_process(self.f3))
     processes.append(create_process(self.f2))
     processes.append(create_process(self.f1))
     concurrent.futures.wait(processes)
     t2 = time.time_ns()
     delta = (t2 - t1) * (10**-9)
     self.assertGreaterEqual(delta, 5)
     self.assertLessEqual(delta, 5.5)
     self.assertEqual((1, 2, 3), tuple(results))
Beispiel #2
0
 def test_one_second_three_processes(self):
     processes = []
     t1 = time.time_ns()
     for _ in range(3):
         processes.append(create_process(self.one_second_three_processes))
     concurrent.futures.wait(processes)
     t2 = time.time_ns()
     delta = (t2 - t1) * (10**-9)
     self.assertGreaterEqual(delta, 1)
     self.assertLessEqual(delta, 1.5)