Esempio n. 1
0
 def test__timeout_is_absolute(self):
     timeout = 2
     with self.assertTakesAlmost(timeout):
         result = local.execute_async("sleep 100",
                                      shell=True,
                                      timeout=timeout)
         with self.assertRaises(CommandTimeout) as caught:
             result.wait()
Esempio n. 2
0
 def test__multiple_executes(self):
     num_secs = 3
     commands = ["sleep {0}".format(num_secs) for i in range(10)]
     with self.assertImmediate():
         results = [local.execute_async(command, shell=True) for command in commands]
     with self.assertTakesAlmost(num_secs):
         results = wait_for_many_results(results)
     self.assertTrue(all(results))
     self.assertEquals(len(results), len(commands))
     self.assertEquals(set(result.get_returncode() for result in results), set([0]))
Esempio n. 3
0
 def test__multiple_executes(self):
     num_secs = 3
     commands = ["sleep {0}".format(num_secs) for i in range(10)]
     with self.assertImmediate():
         results = [
             local.execute_async(command, shell=True)
             for command in commands
         ]
     with self.assertTakesAlmost(num_secs):
         results = wait_for_many_results(results)
     self.assertTrue(all(results))
     self.assertEquals(len(results), len(commands))
     self.assertEquals(set(result.get_returncode() for result in results),
                       set([0]))
Esempio n. 4
0
 def test__timeout_is_absolute(self):
     timeout = 2
     with self.assertTakesAlmost(timeout):
         result = local.execute_async("sleep 100", shell=True, timeout=timeout)
         with self.assertRaises(CommandTimeout) as caught:
             result.wait()