def int_decl(): tasks = Tasks(path='ecpy.tasks.tasks.logic') task = Task(task='loop_task:LoopTask', view='views.loop_view:LoopView') tasks.insert_children(None, [task]) i = Interface(interface='loop_iterable_interface:IterableLoopInterface', views=['views.loop_iterable_view:IterableLoopLabel']) task.insert_children(None, [i]) return task, i
def test_register_interface_decl_view1_bis(int_decl, collector): """Test handling view issues : failed import due to NameError. """ tb = {} task = Task(task='ecpy.tasks.tasks.logic.loop_task:LoopTask', view='ecpy.tasks.tasks.logic.views.loop_view:LoopView') i = Interface(interface='ecpy.tasks.tasks.logic.loop_iterable_interface:IterableLoopInterface', views=['_dumy__:Test', 'ecpy.testing.broken_enaml:Task']) task.insert_children(None, [i]) task.register(collector, tb) assert 'ecpy.LoopTask.IterableLoopInterface_1' in tb assert ('AttributeError' in tb['ecpy.LoopTask.IterableLoopInterface_1'] or 'NameError' in tb['ecpy.LoopTask.IterableLoopInterface_1'])
def test_register_interface_decl_cls1_bis(collector): """Test handling interface class issues : failed import Name error. """ tb = {} task = Task(task='ecpy.tasks.tasks.logic.loop_task:LoopTask', view='ecpy.tasks.tasks.logic.views.loop_view:LoopView') i = Interface(interface='loop_iterable_interface:IterableLoopInterface', views=['views.loop_iterable_view:IterableLoopLabel']) task.insert_children(None, [i]) i.interface = 'ecpy.testing.broken_module:Test' task.register(collector, tb) assert ('ecpy.LoopTask.Test' in tb and 'NameError' in tb['ecpy.LoopTask.Test'])
def test_register_task_decl_children(collector, task_decl): """Test handling child type issue. """ tb = {} task_decl.insert_children(0, [Task()]) task_decl.register(collector, tb) assert 'ecpy.RootTask' in tb and 'Interface' in tb['ecpy.RootTask']
def test_register_interface_decl_children1(int_decl, collector): """Test handling child type issue. """ tb = {} task, i = int_decl i.insert_children(None, [Task()]) task.register(collector, tb) assert 'ecpy.LoopTask:ecpy.IterableLoopInterface' in tb and\ 'Interface' in tb['ecpy.LoopTask:ecpy.IterableLoopInterface']
def test_register_task_decl_extend3(collector, task_decl): """Test extending a task using wrong children. """ tb = {} collector.contributions['ecpy.Task'] = TaskInfos() task_decl.task = 'ecpy.Task' task_decl.insert_children(None, [Task()]) task_decl.register(collector, tb) assert 'ecpy.Task' in tb
def test_register_interface_decl_children2(int_decl, collector): """Test handling child type issue when extending. """ infos = TaskInfos() infos.interfaces['Test'] = InterfaceInfos() collector.contributions['ecpy.Task'] = infos task, interface = int_decl task.task = 'ecpy.Task' interface.interface = 'Test' interface.insert_children(None, [Task()]) tb = {} task.register(collector, tb) assert ('ecpy.Task:Test' in tb and 'Interface' in tb['ecpy.Task:Test'])
def test_register_interface_decl_cls1_bis(collector): """Test handling interface class issues : failed import Name error. """ tb = {} task = Task(task='ecpy.tasks.tasks.logic.loop_task:LoopTask', view='ecpy.tasks.tasks.logic.views.loop_view:LoopView') i = Interface(interface='loop_iterable_interface:IterableLoopInterface', views=['views.loop_iterable_view:IterableLoopLabel']) task.insert_children(None, [i]) i.interface = 'ecpy.testing.broken_module:Test' task.register(collector, tb) assert ('ecpy.LoopTask:ecpy.Test' in tb and 'NameError' in tb['ecpy.LoopTask:ecpy.Test'])
def test_register_interface_decl_view1_bis(int_decl, collector): """Test handling view issues : failed import due to NameError. """ tb = {} task = Task(task='ecpy.tasks.tasks.logic.loop_task:LoopTask', view='ecpy.tasks.tasks.logic.views.loop_view:LoopView') i = Interface( interface= 'ecpy.tasks.tasks.logic.loop_iterable_interface:IterableLoopInterface', views=['_dumy__:Test', 'ecpy.testing.broken_enaml:Task']) task.insert_children(None, [i]) task.register(collector, tb) assert 'ecpy.LoopTask:ecpy.IterableLoopInterface_1' in tb assert ('AttributeError' in tb['ecpy.LoopTask:ecpy.IterableLoopInterface_1'] or 'NameError' in tb['ecpy.LoopTask:ecpy.IterableLoopInterface_1'])
def task_decl(): return Task(task='ecpy.tasks.tasks.base_tasks:RootTask', view='ecpy.tasks.tasks.base_views:RootTaskView')