def test_flatten_configobj():
    """

    """
    config = ConfigObj(os.path.join(os.path.dirname(__file__),
                       'config_test.ini'))

    flat = flatten_config(config, ['task_class', 'selected_profile'])
    assert_in('task_class', flat)
    assert_equal(flat['task_class'],
                 set(['ComplexTask', 'SaveTask', 'LoopTask',
                      'LockInMeasureTask', 'RFSourceSetFrequencyTask',
                      'FormulaTask']))

    assert_in('selected_profile', flat)
    assert_equal(flat['selected_profile'],
                 set(['Lock8', 'Lock12', 'RF19']))
Exemple #2
0
def test_flatten_configobj():
    """

    """
    config = ConfigObj(
        os.path.join(os.path.dirname(__file__), 'config_test.ini'))

    flat = flatten_config(config, ['task_class', 'selected_profile'])
    assert_in('task_class', flat)
    assert_equal(
        flat['task_class'],
        set([
            'ComplexTask', 'SaveTask', 'LoopTask', 'LockInMeasureTask',
            'RFSourceSetFrequencyTask', 'FormulaTask'
        ]))

    assert_in('selected_profile', flat)
    assert_equal(flat['selected_profile'], set(['Lock8', 'Lock12', 'RF19']))
Exemple #3
0
    def collect_build_dep_from_config(self, config):
        """ Read a ConfigObj object to determine all the build dependencies of
        an object and get them in a dict.

        Parameters
        ----------
        manager : TaskManager
            Instance of the task manager.

        coonfig : Section
            Section representing the task hierarchy.

        Returns
        -------
        build_dep : nested dict or None
            Dictionary holding all the build dependencies of an obj.
            With this dict and the config the obj can be reconstructed without
            accessing the workbech.
            None is case of failure.

        """
        members = []
        for build_dep in self.build_collectors.values():
            members.extend(build_dep.walk_members)

        flat_config = flatten_config(config, members)

        build_deps = {}
        for build_dep in self.build_collectors.values():
            try:
                build_deps.update(build_dep.collect(self.workbench,
                                                    flat_config))
            except ValueError as e:
                logger = logging.getLogger(__name__)
                logger.error(e.message)
                return None

        return build_deps
Exemple #4
0
    def collect_build_dep_from_config(self, config):
        """ Read a ConfigObj object to determine all the build dependencies of
        an object and get them in a dict.

        Parameters
        ----------
        manager : TaskManager
            Instance of the task manager.

        coonfig : Section
            Section representing the task hierarchy.

        Returns
        -------
        build_dep : nested dict or None
            Dictionary holding all the build dependencies of an obj.
            With this dict and the config the obj can be reconstructed without
            accessing the workbech.
            None is case of failure.

        """
        members = []
        for build_dep in self.build_collectors.values():
            members.extend(build_dep.walk_members)

        flat_config = flatten_config(config, members)

        build_deps = {}
        for build_dep in self.build_collectors.values():
            try:
                build_deps.update(
                    build_dep.collect(self.workbench, flat_config))
            except ValueError as e:
                logger = logging.getLogger(__name__)
                logger.error(e.message)
                return None

        return build_deps