Example #1
0
def test_subtasks():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('super', 10)
    task_progress.subtaskStarted('sub1', 'super', 10)
    task_progress.taskProgress('sub1', 5)
    task_progress.taskProgress('sub1', 5)
    task_progress.taskFinish('sub1')

    task_progress.subtaskStarted('sub2', 'super', 10, 5)
    task_progress.taskProgress('sub2', 5)
    task_progress.taskProgress('sub2', 5)
    task_progress.taskFinish('sub2')
    task_progress.taskFinish('super')
    assert listener.getBuffer() == '''\
    Started    super ..................................................
    Started    sub1 ..................................................
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub1 ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     sub1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Started    sub2 ..................................................
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub2 ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub2 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     sub2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     super XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #2
0
def test_interleaved():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskE', 15)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskStarted('taskD', 15)
    task_progress.taskProgress('taskD', 5)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskProgress('taskD', 5)
    task_progress.taskFinish('taskE')
    task_progress.taskProgress('taskD', 5)
    task_progress.taskFinish('taskD')
    assert listener.getBuffer() == '''\
    Started    taskE ..................................................
    Progress   taskE ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Started    taskD ..................................................
    Progress   taskD ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Progress   taskE ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskE OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskD ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   taskD OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskD XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #3
0
def test_subtasks():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('super', 10)
    task_progress.subtaskStarted('sub1', 'super', 10)
    task_progress.taskProgress('sub1', 5)
    task_progress.taskProgress('sub1', 5)
    task_progress.taskFinish('sub1')

    task_progress.subtaskStarted('sub2', 'super', 10, 5)
    task_progress.taskProgress('sub2', 5)
    task_progress.taskProgress('sub2', 5)
    task_progress.taskFinish('sub2')
    task_progress.taskFinish('super')
    assert listener.getBuffer() == '''\
    Started    super ..................................................
    Started    sub1 ..................................................
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub1 ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub1 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     sub1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Started    sub2 ..................................................
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub2 ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   sub2 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     sub2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   super ,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     super XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #4
0
def test_interleaved():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskE', 15)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskStarted('taskD', 15)
    task_progress.taskProgress('taskD', 5)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskProgress('taskE', 5)
    task_progress.taskProgress('taskD', 5)
    task_progress.taskFinish('taskE')
    task_progress.taskProgress('taskD', 5)
    task_progress.taskFinish('taskD')
    assert listener.getBuffer() == '''\
    Started    taskE ..................................................
    Progress   taskE ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Started    taskD ..................................................
    Progress   taskD ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Progress   taskE ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskE OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskD ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Progress   taskD OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskD XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #5
0
 def __init__(self, window, title, text, watchedTasks, execute=True):
     ProgressWindow.__init__(self, window, title, text, execute)
     self.watchedTasks = watchedTasks
     self.tasksToFinish = set(watchedTasks)
     task_progress.addNotificationListener(self)
     # we don't want to pulse more often than once every 1/10 of a second
     self.hyperactivityThreshold = 0.1
     self.lastPulse = 0
Example #6
0
 def __init__(self, window, title, text, watchedTasks, execute=True):
     ProgressWindow.__init__(self, window, title, text, execute)
     self.watchedTasks = watchedTasks
     self.tasksToFinish = set(watchedTasks)
     task_progress.addNotificationListener(self)
     # we don't want to pulse more often than once every 1/10 of a second
     self.hyperactivityThreshold = 0.1
     self.lastPulse = 0
Example #7
0
def test_simple_amounts():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskC', 15)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskFinish('taskC')
    assert listener.getBuffer() == '''\
    Started    taskC ..................................................
    Progress   taskC ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Progress   taskC ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskC OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskC XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #8
0
def test_simple_noamounts():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskFinish('taskA')
    assert listener.getBuffer() == '''\
    Started    taskA ..................................................
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     taskA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #9
0
def test_simple_noamounts():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskProgress('taskA')
    task_progress.taskFinish('taskA')
    assert listener.getBuffer() == '''\
    Started    taskA ..................................................
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskA ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     taskA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #10
0
def test_overshoot():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskOvershoot', 8)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskFinish('taskOvershoot')
    assert listener.getBuffer() == '''\
    Started    taskOvershoot ..................................................
    Progress   taskOvershoot ,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskOvershoot OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskOvershoot OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskOvershoot XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #11
0
def test_simple_amounts():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskC', 15)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskProgress('taskC', 5)
    task_progress.taskFinish('taskC')
    assert listener.getBuffer() == '''\
    Started    taskC ..................................................
    Progress   taskC ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOO
    Progress   taskC ,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskC OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskC XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #12
0
def test_overshoot():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskOvershoot', 8)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskProgress('taskOvershoot', 5)
    task_progress.taskFinish('taskOvershoot')
    assert listener.getBuffer() == '''\
    Started    taskOvershoot ..................................................
    Progress   taskOvershoot ,,,,,,,,,,,,,,,,,,,OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskOvershoot OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Progress   taskOvershoot OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    Finish     taskOvershoot XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #13
0
def test_simple_nototal():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskB')
    task_progress.taskProgress('taskB', 5)
    task_progress.taskProgress('taskB', 25)
    task_progress.taskProgress('taskB', 5)
    task_progress.taskFinish('taskB')

    assert listener.getBuffer() == '''\
    Started    taskB ..................................................
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     taskB XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #14
0
def test_simple_nototal():
    listener = IndentedStringListener()
    task_progress.addNotificationListener(listener)
    task_progress.taskStarted('taskB')
    task_progress.taskProgress('taskB', 5)
    task_progress.taskProgress('taskB', 25)
    task_progress.taskProgress('taskB', 5)
    task_progress.taskFinish('taskB')

    assert listener.getBuffer() == '''\
    Started    taskB ..................................................
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Progress   taskB ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Finish     taskB XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    '''
    task_progress.removeNotificationListener(listener)
Example #15
0
 def __init__(self, watchedTasks):
     self.watchedTasks = watchedTasks
     task_progress.addNotificationListener(self)
     self.lastDot = 0
     # we don't want to pulse more often than once every 2/10 seconds
     self.hyperactivityThreshold = 0.2
Example #16
0
def main():
    listener1 = StdoutListener()
    task_progress.addNotificationListener(listener1)
    for func in globals():
        if func.startswith('test_'):
            globals()[func]()
Example #17
0
def test_null():
    listener = StringListener()
    task_progress.addNotificationListener(listener)
    assert listener.buffer == ''
    task_progress.removeNotificationListener(listener)
Example #18
0
def main():
    listener1 = StdoutListener()
    task_progress.addNotificationListener(listener1)
    for func in globals():
        if func.startswith('test_'):
            globals()[func]()
Example #19
0
def test_null():
    listener = StringListener()
    task_progress.addNotificationListener(listener)
    assert listener.buffer == ''
    task_progress.removeNotificationListener(listener)
Example #20
0
 def __init__(self, watchedTasks):
     self.watchedTasks = watchedTasks
     task_progress.addNotificationListener(self)
     self.lastDot = 0
     # we don't want to pulse more often than once every 2/10 seconds
     self.hyperactivityThreshold = 0.2