def test_execute_tasks(self):
    'Test _execute_tasks joins all threads after executing all tasks.'
    build_tasks = collections.deque()
    TASK_COUNT = 2
    count = TASK_COUNT
    while count:
        task = threading.Thread(target=build._minify, args=(INVALID_INPUT_FILEPATH, INVALID_OUTPUT_FILEPATH))
        build_tasks.append(task)
        count -= 1
    self.assertEqual(threading.active_count(), 1)
    build._execute_tasks(build_tasks)
    with self.assertRaisesRegexp(OSError, 'threads can only be started once'):
        build._execute_tasks(build_tasks)
    self.assertEqual(threading.active_count(), 1)
Test _execute_tasks joins all threads after executing all tasks.
def test_execute_tasks(self):
    
    build_tasks = collections.deque()
    TASK_COUNT = 2
    count = TASK_COUNT
    while count:
        task = threading.Thread(target=build._minify, args=(INVALID_INPUT_FILEPATH, INVALID_OUTPUT_FILEPATH))
        build_tasks.append(task)
        count -= 1
    self.assertEqual(threading.active_count(), 1)
    build._execute_tasks(build_tasks)
    with self.assertRaisesRegexp(OSError, 'threads can only be started once'):
        build._execute_tasks(build_tasks)
    self.assertEqual(threading.active_count(), 1)