def test_view_with_subtask(self, exopy_qtbot, task_workbench): """Test the LoopTask view. """ core = task_workbench.get_plugin('enaml.workbench.core') root = RootTaskView(core=core) self.task.task = BreakTask(name='Aux') show_and_close_widget(exopy_qtbot, LoopView(task=self.task, root=root))
def test_perform3(self, iterable_interface): """Test performing a simple loop no timing. Break. """ self.task.interface = iterable_interface self.task.add_child_task( 0, BreakTask(name='break', condition='{Test_value} == 5')) self.root.prepare() self.task.perform() assert self.root.get_from_database('Test_value') == 5
def edition_view(measurement, workspace, exopy_qtbot): """Start plugins and add measurements before creating the execution view. """ pl = measurement.plugin pl.edited_measurements.add(measurement) measurement.root_task.add_child_task(0, BreakTask(name='Test')) item = MeasurementEditorDockItem(workspace=workspace, measurement=measurement, name='test') return DockItemTestingWindow(widget=item)
def test_copy_action(workspace, measurement, exopy_qtbot): """Test copying a task does work. """ task = BreakTask(name='Test') measurement.root_task.add_child_task(0, task) action = TaskCopyAction(workspace=workspace, action_context=dict(copyable=True, data=(None, None, task, None))) action.triggered = True new = CLIPBOARD.instance assert isinstance(new, BreakTask) assert new.name == 'Test'
def test_perform3(self): """Test handling of BreakTask and ContinueTask. """ self.task.condition = 'True' self.task.add_child_task(0, BreakTask(name='Break', condition='True')) self.task.add_child_task( 0, ContinueTask(name='Continue', condition='{Test_index} < 5')) self.root.prepare() self.task.perform() assert not self.check.perform_called assert self.task.get_from_database('Test_index') == 5
def test_perform_task2(self): """Test performing a loop with an embedded task no timing. Break. """ interface = IterableLoopInterface() interface.iterable = 'range(11)' self.task.interface = interface self.task.task = CheckTask(name='check') self.task.add_child_task( 0, BreakTask(name='Break', condition='{Test_index} == 6')) self.root.prepare() self.task.perform() assert self.root.get_from_database('Test_index') == 6 assert self.task.task.perform_called assert self.task.task.perform_value == 5
def test_perform_timing_task2(self, iterable_interface): """Test performing a loop with an embedded task no timing. Break. """ self.task.interface = iterable_interface self.task.timing = True self.task.task = CheckTask(name='check') self.task.add_child_task( 0, BreakTask(name='break', condition='{Test_index} == 1')) self.root.prepare() self.task.perform() assert self.root.get_from_database('Test_index') == 1 assert self.task.task.perform_called assert self.task.task.perform_value == 0 assert self.root.get_from_database('Test_elapsed_time') != 1.0
def test_break_view(exopy_qtbot): """Test the BreakTask view. """ show_and_close_widget(exopy_qtbot, BreakView(task=BreakTask(name='Test')))