Exemplo n.º 1
0
    def testTaskExecutionWithUnexecutedDeps(self):
        def RecipeA():
            self.fail()

        def RecipeB():
            RecipeB.counter += 1

        RecipeB.counter = 0

        a = task_manager.Task('hello.json', 'out/hello.json', [], RecipeA)
        b = task_manager.Task('hello.json', 'out/hello.json', [a], RecipeB)
        self.assertEqual(0, RecipeB.counter)
        b.Execute()
        self.assertEqual(1, RecipeB.counter)
 def testStaticTask(self):
     task = task_manager.Task('hello.json', 'what/ever/hello.json', [],
                              None)
     self.assertTrue(task.IsStatic())
     self.assertTrue(task._is_done)
     with self.assertRaises(task_manager.TaskError):
         task.Execute()
Exemplo n.º 3
0
def __start_publishing():
    """
    Starts the publishing process of stress test clients.
    """
    for publisher in publishers:
        # Creates a task for each client to start publishing.
        packet_interval_ticks = task_manager.convertMsToTicks(
            publisher.packet_interval_ms)
        task = task_manager.Task(publisher.publish_message,
                                 packet_interval_ticks,
                                 publisher.total_packets_to_send)
        task_manager.add_task(task)
    task_manager.start(__gather_results)
Exemplo n.º 4
0
    def testTaskExecution(self):
        def Recipe():
            Recipe.counter += 1

        Recipe.counter = 0
        task = task_manager.Task('hello.json', 'what/ever/hello.json', [],
                                 Recipe)
        self.assertFalse(task._is_done)
        self.assertEqual(0, Recipe.counter)
        task.Execute()
        self.assertEqual(1, Recipe.counter)
        task.Execute()
        self.assertEqual(1, Recipe.counter)