Example #1
0
    def setup(self):

        self.workbench = Workbench()
        self.workbench.register(CoreManifest())
        self.workbench.register(StateManifest())
        self.workbench.register(PreferencesManifest())
        self.workbench.register(DependenciesManifest())
Example #2
0
    def test_init(self):
        path = os.path.join(self.test_dir, 'default_test.ini')
        conf = ConfigObj(path)
        conf[u'test.prefs'] = {}
        conf[u'test.prefs']['string'] = 'test'
        conf.write()

        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        contrib = self.workbench.get_plugin(u'test.prefs')
        assert contrib.string == 'test'
        assert contrib.auto == ''

        pref_plugin = self.workbench.get_plugin(u'hqc_meas.preferences')
        pref_plugin.default_file = 'test.ini'

        self.workbench.unregister(u'test.prefs')
        self.workbench.unregister(u'hqc_meas.preferences')

        directory = os.path.dirname(__file__)
        util_path = os.path.join(directory, '..', '..', '..', 'hqc_meas',
                                 'utils', 'preferences')
        def_path = os.path.join(util_path, 'default.ini')
        def_conf = ConfigObj(def_path)
        assert def_conf['file'] == 'test.ini'
        def_conf['file'] = 'default_test.ini'
        def_conf.write()
Example #3
0
    def test_get_plugin_pref1(self):
        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        core = self.workbench.get_plugin('enaml.workbench.core')
        pref = core.invoke_command('hqc_meas.preferences.get_plugin_prefs',
                                   {'plugin_id': u'test.prefs'}, self)
        assert pref == {}
    def setup(self):
        self.workbench = Workbench()
        self.workbench.register(CoreManifest())
        self.workbench.register(StateManifest())
        self.workbench.register(PreferencesManifest())
        self.workbench.register(TaskManagerManifest())

        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = self.excep_class(task_name='Test', condition='rr')
        self.root.children_task.append(self.task)
Example #5
0
    def setup(self):
        self.workbench = Workbench()
        self.workbench.register(CoreManifest())
        self.workbench.register(StateManifest())
        self.workbench.register(PreferencesManifest())
        self.workbench.register(TaskManagerManifest())

        self.root = RootTask(should_stop=Event(), should_pause=Event())
        self.task = SaveArrayTask(task_name='Test')
        self.root.children_task.append(self.task)
Example #6
0
    def setup(self):

        self.workbench = Workbench()
        self.workbench.register(CoreManifest())
        self.workbench.register(StateManifest())
        self.workbench.register(PreferencesManifest())
        self.workbench.register(DependenciesManifest())
        self.workbench.register(TaskManagerManifest())
        self.workbench.register(MeasureManifest())
        self.workbench.register(TestSuiteManifest())
Example #7
0
    def setup(self):
        self.workbench = Workbench()
        self.workbench.register(CoreManifest())
        self.workbench.register(UIManifest())
        self.workbench.register(StateManifest())
        self.workbench.register(PreferencesManifest())
        self.workbench.register(LogManifest())
        self.workbench.register(MeasureManifest())

        # Needed otherwise the monitor manifest is not registered.
        self.workbench.get_plugin(u'hqc_meas.measure')
Example #8
0
    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 = MeasDCVoltageTask(task_name='Test')
        self.root.children_task.append(self.task)
        self.root.run_time['drivers'] = {'Test': InstrHelper}
Example #9
0
    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())
Example #10
0
    def test_save1(self):
        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        contrib = self.workbench.get_plugin(u'test.prefs')
        contrib.string = 'test_save'
        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.save', {}, self)

        path = os.path.join(self.test_dir, 'default_test.ini')
        ref = {u'test.prefs': {'string': 'test_save', 'auto': ''}}
        assert_true(os.path.isfile(path))
        assert_equal(ConfigObj(path).dict(), ref)
Example #11
0
    def test_auto_sync(self):
        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        contrib = self.workbench.get_plugin(u'test.prefs')
        contrib.auto = 'test_auto'

        ref = {u'test.prefs': {'auto': 'test_auto'}}
        pref_plugin = self.workbench.get_plugin(u'hqc_meas.preferences')
        assert_equal(pref_plugin._prefs, ref)
        path = os.path.join(self.test_dir, 'default_test.ini')
        assert_true(os.path.isfile(path))
        assert_equal(ConfigObj(path).dict(), ref)
Example #12
0
    def test_get_plugin_pref2(self):
        path = os.path.join(self.test_dir, 'default_test.ini')
        conf = ConfigObj(path)
        conf[u'test.prefs'] = {}
        conf[u'test.prefs']['string'] = 'test'
        conf.write()

        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        core = self.workbench.get_plugin('enaml.workbench.core')
        pref = core.invoke_command('hqc_meas.preferences.get_plugin_prefs',
                                   {'plugin_id': u'test.prefs'}, self)
        assert pref['string'] == 'test'
Example #13
0
    def test_load2(self):
        # Test loading preferences from non-existing file.

        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        path = os.path.join(self.test_dir, 'default_test.ini')
        conf = ConfigObj(path)
        conf[u'test.prefs'] = {}
        conf[u'test.prefs']['string'] = 'test'
        conf.write()

        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.load', {'path': ''}, self)
Example #14
0
    def test_save2(self):
        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        contrib = self.workbench.get_plugin(u'test.prefs')
        contrib.string = 'test_save'

        path = os.path.join(self.test_dir, 'custom_test.ini')
        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.save', {'path': path}, self)

        ref = {u'test.prefs': {'string': 'test_save', 'auto': ''}}
        assert os.path.isfile(path)
        assert ConfigObj(path).dict() == ref
Example #15
0
    def test_update_prefs(self):
        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        contrib = self.workbench.get_plugin(u'test.prefs')
        contrib.string = 'test_update'
        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.update_plugin_prefs',
                            {'plugin_id': u'test.prefs'}, self)

        pref_plugin = self.workbench.get_plugin(u'hqc_meas.preferences')
        assert_equal(pref_plugin._prefs,
                     {u'test.prefs': {
                         'string': 'test_update',
                         'auto': ''
                     }})
Example #16
0
    def test_load1(self):
        # Test loading default preferences.

        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        path = os.path.join(self.test_dir, 'default_test.ini')
        conf = ConfigObj(path)
        conf[u'test.prefs'] = {}
        conf[u'test.prefs']['string'] = 'test'
        conf.write()

        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.load', {}, self)
        contrib = self.workbench.get_plugin(u'test.prefs')

        assert contrib.string == 'test'
Example #17
0
    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
Example #18
0
    def test_load3(self):
        # Test loading preferences from non-default file.

        self.workbench.register(PreferencesManifest())
        self.workbench.register(PrefContributor())

        path = os.path.join(self.test_dir, 'custom_test.ini')
        conf = ConfigObj(path)
        conf[u'test.prefs'] = {}
        conf[u'test.prefs']['string'] = 'test'
        conf.write()

        # Checks that when loading preferences no plugin is started if it does
        # not already exist.
        core = self.workbench.get_plugin('enaml.workbench.core')
        core.invoke_command('hqc_meas.preferences.load', {'path': path}, self)
        contrib = self.workbench.get_plugin(u'test.prefs')

        assert_equal(contrib.string, '')

        core.invoke_command('hqc_meas.preferences.load', {'path': path}, self)

        assert_equal(contrib.string, 'test')
Example #19
0
                        "--workspace",
                        help='select start-up workspace',
                        default='measure',
                        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()
Example #20
0
 def setup(self):
     self.workbench = Workbench()
     self.workbench.register(CoreManifest())
     self.workbench.register(PreferencesManifest())
     self.workbench.register(LogManifest())