4 from unittest import TestCase
6 from htsworkflow.util.queuecommands import QueueCommands
8 class testQueueCommands(TestCase):
10 logging.basicConfig(level=logging.DEBUG,
11 format='%(asctime)s %(name)-8s %(message)s')
13 def test_unlimited_run_slow(self):
15 Run everything at once
17 cmds = ['/bin/sleep 0',
21 q = QueueCommands(cmds, 3)
24 end = time.time()-start
25 # we should only take the length of the longest sleep
26 self.failUnless( end > 1.9 and end < 2.1,
27 "took %s seconds, exected ~2" % (end,))
29 def test_limited_run_slow(self):
31 Run a limited number of jobs
33 cmds = ['/bin/sleep 1',
37 q = QueueCommands(cmds, 2)
41 end = time.time()-start
42 self.failUnless( end > 3.9 and end < 4.1,
43 "took %s seconds, expected ~4" % (end,))
47 from unittest import TestSuite, defaultTestLoader
49 suite.addTests(defaultTestLoader.loadTestsFromTestCase(testQueueCommands))
53 if __name__ == "__main__":
54 from unittest import main
55 main(defaultTest="suite")