7 from gaworkflow.util.queuecommands import QueueCommands
9 class testQueueCommands(unittest.TestCase):
11 logging.basicConfig(level=logging.DEBUG,
12 format='%(asctime)s %(name)-8s %(message)s')
16 def test_unlimited_run(self):
18 Run everything at once
20 cmds = [['/bin/sleep', '0'],
24 q = QueueCommands(cmds)
27 end = time.time()-start
28 # we should only take the length of the longest sleep
29 self.failUnless( end > 1.9 and end < 2.1,
30 "took %s seconds, exected ~5" % (end,))
32 def test_limited_run(self):
34 Run a limited number of jobs
36 cmds = [['/bin/sleep', '1'],
40 q = QueueCommands(cmds, 2)
44 end = time.time()-start
45 self.failUnless( end > 3.9 and end < 4.1,
46 "took %s seconds, expected ~6" % (end,))
49 return unittest.makeSuite(testQueueCommands, 'test')
51 if __name__ == "__main__":
52 unittest.main(defaultTest='suite')