def test_taskinthread_exception(): tasks = qtools.TasksInThread(TestTasks) # an exception happens in the thread, there's just a warning message # displayed, the worker thread does not die tasks.exception() tasks.join() # now this raises an exception on the client tasks.get_result()
def main0(): global tasks0, tasks1 tasks0 = qtools.TasksInThread(TestTasks, use_master_thread=False) tasks0.squareDone.connect(square_done) tasks0.square(3) tasks1 = qtools.TasksInProcess(TestTasks, use_master_thread=False) tasks1.operation(3, 4, coeff=2)
def test_tasksinthread_nocallback(): """Test a task without callback.""" tasks = qtools.TasksInThread(TestTasks) tasks.nocallback(3) tasks.join() assert tasks.get_result() == 3
def test_tasksinthread_operation(): tasks = qtools.TasksInThread(TestTasks) tasks.operation(3, 4, coeff=2) tasks.join() assert tasks.get_result() == 14
def test_tasksinthread_square(): tasks = qtools.TasksInThread(TestTasks) tasks.square(3) tasks.join() assert tasks.get_result() == 9
def test_tasksinprocess_operation(): tasks = qtools.TasksInThread(TestTasks) tasks.operation(3, 4, coeff=2) tasks.join()