'Test for running jobs on the thread pool.
This runs 1500 tasks on the ThreadPool and waits for them to
complete.'

def testRunTasks(self):

    self.test_pool.Join()
    self.lock = threading.Lock()
    def Insert(list_obj, element):
        with self.lock:
            list_obj.append(element)
    test_list = []
    for i in range(self.NUMBER_OF_TASKS):
        self.test_pool.AddTask(Insert, (test_list, i))
    self.test_pool.Join()
    test_list.sort()
    self.assertEqual(range(self.NUMBER_OF_TASKS), test_list)
