def test_views_request(self): self.workbench.register(TaskManagerManifest()) core = self.workbench.get_plugin(u'enaml.workbench.core') com = u'hqc_meas.task_manager.views_request' with enaml.imports(): from hqc_meas.tasks.views.base_task_views import ComplexView views, miss = core.invoke_command(com, {'task_classes': ['ComplexTask']}, self) assert_in('ComplexTask', views) assert_equal(views['ComplexTask'], ComplexView) assert_equal(miss, [])
def setup(self): self.workbench = Workbench() self.workbench.register(CoreManifest()) self.workbench.register(StateManifest()) self.workbench.register(PreferencesManifest()) self.workbench.register(InstrManagerManifest()) self.workbench.register(TaskManagerManifest()) self.root = RootTask(should_stop=Event(), should_pause=Event()) self.task = SetRFFrequencyTask(task_name='Test') self.root.children_task.append(self.task) self.root.run_time['drivers'] = {'Test': InstrHelper}
def setup(self): self.workbench = Workbench() self.workbench.register(CoreManifest()) self.workbench.register(UIManifest()) self.workbench.register(HqcAppManifest()) self.workbench.register(StateManifest()) self.workbench.register(PreferencesManifest()) self.workbench.register(LogManifest()) self.workbench.register(TaskManagerManifest()) self.workbench.register(InstrManagerManifest()) self.workbench.register(MeasureManifest()) self.workbench.register(TestSuiteManifest())
def test_tasks_request2(self): # Test requesting a task using its class name. self.workbench.register(TaskManagerManifest()) core = self.workbench.get_plugin(u'enaml.workbench.core') com = u'hqc_meas.task_manager.tasks_request' tasks, miss = core.invoke_command(com, { 'tasks': ['ComplexTask', 'SleepTask'], 'use_class_names': True }, self) from hqc_meas.tasks.api import ComplexTask assert_equal(sorted(tasks.keys()), sorted(['ComplexTask', 'SleepTask'])) assert_in(ComplexTask, tasks.values()) assert_equal(miss, [])
def test_config_request_build2(self): self.workbench.register(TaskManagerManifest()) core = self.workbench.get_plugin(u'enaml.workbench.core') com = u'hqc_meas.task_manager.config_request' conf, view = core.invoke_command(com, {'task': 'Template'}, self) assert_equal(type(conf).__name__, 'IniConfigTask') conf.task_name = 'Test' assert_equal(conf.config_ready, True) task = conf.build_task() assert_equal(task.task_name, 'Test') assert_equal(len(task.children_task), 1) task2 = task.children_task[0] assert_equal(task2.task_name, 'a') assert_equal(task2.task_class, 'LogTask')
def test_template_observation(self): self.workbench.register(TaskManagerManifest()) plugin = self.workbench.get_plugin(u'hqc_meas.task_manager') assert_in('Template', plugin.tasks) template_path = os.path.join(self.test_dir, 'temp_templates') prof = ConfigObj(os.path.join(template_path, 'test.ini')) prof.write() from time import sleep sleep(0.5) try: assert_in('Test', plugin.tasks) assert_in('Template', plugin.tasks) finally: os.remove(os.path.join(template_path, 'test.ini')) sleep(0.5) assert_not_in('Test', plugin.tasks) assert_in('Template', plugin.tasks)
def test_init(self): self.workbench.register(TaskManagerManifest()) plugin = self.workbench.get_plugin(u'hqc_meas.task_manager') # Testing task explorations. assert_in('Complex', plugin.tasks) assert_not_in('Instr', plugin.tasks) assert_in('Log', plugin.tasks) assert_in('Definition', plugin.tasks) assert_in('Sleep', plugin.tasks) # Testing interface exploration assert_in('SetDCVoltageTask', plugin._task_interfaces) assert_not_equal(plugin._task_interfaces['SetDCVoltageTask'], []) # Testing templates assert_in('Template', plugin.tasks)
def test_config_request_build3(self): self.workbench.register(TaskManagerManifest()) core = self.workbench.get_plugin(u'enaml.workbench.core') com = u'hqc_meas.task_manager.config_request' plugin = self.workbench.get_plugin(u'hqc_meas.task_manager') if u'tasks.tasks_logic' in plugin.tasks_loading: aux = plugin.tasks_loading[:] aux.remove(u'tasks.tasks_logic') plugin.tasks_loading = aux conf, view = core.invoke_command(com, {'task': 'Loop'}, self) assert_equal(type(conf).__name__, 'LoopConfigTask') conf.task_name = 'Test' conf.subtask = 'Log' assert_equal(conf.config_ready, True) task = conf.build_task() assert_equal(task.task_name, 'Test')
def setup(self): self.workbench = Workbench() self.workbench.register(CoreManifest()) self.workbench.register(UIManifest()) self.workbench.register(HqcAppManifest()) self.workbench.register(StateManifest()) self.workbench.register(PreferencesManifest()) self.workbench.register(LogManifest()) self.workbench.register(DependenciesManifest()) self.workbench.register(TaskManagerManifest()) self.workbench.register(InstrManagerManifest()) self.workbench.register(MeasureManifest()) self.workbench.register(TestSuiteManifest()) # Adding by hand the false instr task. plugin = self.workbench.get_plugin('hqc_meas.task_manager') plugin._py_tasks['False instr'] = FalseInstrTask
def test_collect_dependencies(self): # Test collecting build dependencies. self.workbench.register(TaskManagerManifest()) from hqc_meas.tasks.api import RootTask, ComplexTask from hqc_meas.tasks.tasks_util.log_task import LogTask aux = [LogTask(task_name='r')] root = RootTask(task_name='root') root.children_task = [ ComplexTask(task_name='complex', children_task=aux), LogTask(task_name='t') ] core = self.workbench.get_plugin(u'enaml.workbench.core') com = u'hqc_meas.dependencies.collect_dependencies' res, build, run = core.invoke_command(com, {'obj': root}, core) assert_true(res) assert_in('tasks', build) assert_equal(sorted(['LogTask', 'ComplexTask']), sorted(build['tasks'].keys())) assert_not_in('interfaces', build) assert_false(run)
choices=WORKSPACES) parser.add_argument("-s", "--nocapture", help="Don't capture stdout/stderr", action='store_false') args = parser.parse_args() workbench = Workbench() workbench.register(CoreManifest()) workbench.register(UIManifest()) workbench.register(HqcAppManifest()) workbench.register(StateManifest()) workbench.register(PreferencesManifest()) workbench.register(LogManifest()) workbench.register(DependenciesManifest()) workbench.register(TaskManagerManifest()) workbench.register(InstrManagerManifest()) workbench.register(MeasureManifest()) workbench.register(DebuggerManifest()) core = workbench.get_plugin('enaml.workbench.core') core.invoke_command('hqc_meas.logging.start_logging', {'std': args.nocapture}, workbench) core.invoke_command('enaml.workbench.ui.select_workspace', {'workspace': WORKSPACES[args.workspace]}, workbench) ui = workbench.get_plugin(u'enaml.workbench.ui') ui.show_window() ui.window.maximize() ui.start_application()