Ejemplo n.º 1
0
    def __init__(self, self_cfg, import_dest):
        tracer.info("called")
        self.useable = False
        self._cfg = dict(self.default_config)
        self._cfg.update(self_cfg)
        self._dest = dict()
        self._entries = None
        self._topics = None

        import_dest_cfg = Cfg(import_dest)
        try:
            req_dirs = import_dest_cfg.get_rvalue("requirements_dirs")
            if req_dirs[0] and os.path.isdir(req_dirs[0]):
                self.useable = True
                self._dest["requirements_dirs"] = req_dirs[0]
        except RMTException:
            self.useable = False
        try:
            topics_dirs = import_dest_cfg.get_rvalue("topics_dirs")
            if topics_dirs[0] and os.path.isdir(topics_dirs[0]):
                self.useable = True
                self._dest["topics_dirs"] = topics_dirs[0]
        except RMTException:
            self.useable = False
        self._wb = None
        tracer.debug("Finished.")
Ejemplo n.º 2
0
 def main_setup_config(args):
     """Setup the config for main()"""
     config = Cfg()
     DefaultValues.set_default_values(config)
     config.merge_cmd_line_params(args)
     config.evaluate()
     return config
Ejemplo n.º 3
0
 def __init__(self, config):
     cfg = Cfg(config)
     Interface.__init__(self, cfg)
     tracer.info("called")
     self.__topic_root_node = cfg.get_rvalue("topic_root_node")
     self.__dirs = {}
     self.__setup_directories(cfg)
Ejemplo n.º 4
0
    def test_pos_01(self):
        "TxtIOConfig: check new max line length setting"
        config = Cfg()
        config.set_value('max_input_line_length', 77)

        tic = TxtIOConfig(config, 'requirement')

        assert (tic.get_max_line_length() == 77)
Ejemplo n.º 5
0
 def __init__(self, config):
     '''Constructs the standard output parameters based on the
        provided config.'''
     self._output_filename = None
     self._start_date = None
     self._end_date = None
     self._config = Cfg(config)
     self.__parse()
Ejemplo n.º 6
0
 def _extract_input_dir(self, config):
     input_cfg = Cfg(config)
     sources_dirs = "topics.ts_common.sources"
     for cfg in input_cfg.get_value(sources_dirs):
         for req_idx in [
                 "requirements_dirs", "topics_dirs", "sources_dirs"
         ]:
             if req_idx in cfg[1]:
                 self._input_dir[req_idx] = cfg[1][req_idx]
Ejemplo n.º 7
0
    def test_empty_configuration(self):
        '''Checks the empty configuration with different types of parameters'''
        config = Cfg()

        self.failUnlessRaises(RMTException, config.get_value, "k")
        self.failUnlessRaises(RMTException, config.get_value, "k.i")
        self.failUnlessRaises(RMTException, config.get_value, "k.i.j")
        self.failUnlessRaises(RMTException, config.get_value, ['k'])
        self.failUnlessRaises(RMTException, config.get_value, ['k', 'i'])
        self.failUnlessRaises(RMTException, config.get_value, ['k', 'i', 'j'])
Ejemplo n.º 8
0
 def rmttest_positive_02(self):
     "TopicSet - valid"
     cfg = Cfg()
     cfg.set_value('hahaha.directory',
                   'tests/unit-test/topic-tests/testdata/topicset01')
     cfg.set_value('hahaha.name', 't01')
     cfg.set_value('topics.test-name01.output', {})
     cfg.set_value('topic_root_node', 'RootNode')
     tvcs = TestVCS(cfg)
     tobjcache = ObjectCache()
     tinmod = TestInputModules()
     TopicSet(cfg, tvcs, "test-name01", tobjcache, tinmod)
Ejemplo n.º 9
0
 def __init__(self, oconfig):
     '''Create a graph output object.'''
     tracer.debug("Called: html ouput module constructed.")
     self._config = Cfg(oconfig)
     CreateMakeDependencies.__init__(self)
     self.__fd_stack = []
     self.__topic_name_set = []
     # Take care about the openess of the ul.
     self.__ul_open_stack = []
     self.__output_directory = self._config.get_rvalue('output_directory')
     self.html_header_filename = self._config.get_rvalue('header')
     self.html_footer_filename = self._config.get_rvalue('footer')
     self.read_html_arts()
Ejemplo n.º 10
0
    def test_positive_03(self):
        "TopicSet - valid with empty requirement set"

        tioconfig = TxtIOConfig()
        cfg = Cfg()
        cfg.set_value('huhuhu.directory',
                      'tests/unit-test/topic-tests/testdata/topicset01')
        cfg.set_value('huhuhu.name', 't01')
        cfg.set_value('topics.test-name02.output', {})
        cfg.set_value('topic_root_node', 'RootNode')
        tvcs = TestVCS(cfg)
        tobjcache = ObjectCache()
        tinmod = TestInputModules()
        topicset = TopicSet(cfg, tvcs, "test-name02", tobjcache, tinmod)
Ejemplo n.º 11
0
    def rmttest_empty_configuration(self):
        '''Checks the empty configuration with different types of parameters'''
        config = Cfg()

        with pytest.raises(RMTException):
            config.get_value("k")
        with pytest.raises(RMTException):
            config.get_value("k.i")
        with pytest.raises(RMTException):
            config.get_value("k.i.j")
        with pytest.raises(RMTException):
            config.get_value(['k'])
        with pytest.raises(RMTException):
            config.get_value(['k', 'i'])
        with pytest.raises(RMTException):
            config.get_value(['k', 'i', 'j'])
Ejemplo n.º 12
0
    def rmttest_positive_01(self):
        "TopicSet - constructor with only one element"
        try:
            cfg = Cfg()
            cfg.set_value('ahah.directory',
                          'tests/unit-test/topic-tests/testdata/topicset01')
            cfg.set_value('ahah.name', 't01')
            cfg.set_value('topics.bkdkd.output', {})

            cfg.set_value('topic_root_node', 'RootNode')
            tvcs = TestVCS(cfg)
            tobjcache = ObjectCache()
            tinmod = TestInputModules()
            TopicSet(cfg, tvcs, "bkdkd", tobjcache, tinmod)
            self.assertTrue(False)
        except AssertionError:
            pass
Ejemplo n.º 13
0
    def __init__(self, config):
        tracer.info("called")
        cfg = Cfg(config)
        Interface.__init__(self, cfg)
        self.__start_vers = cfg.get_rvalue("start_vers")
        self.__end_vers = cfg.get_rvalue("end_vers")
        self.__topic_root_node = cfg.get_rvalue("topic_root_node")
        tracer.debug(
            "start version [%s] end version [%s] "
            "topic root node [%s]" %
            (self.__start_vers, self.__end_vers, self.__topic_root_node))

        # When the directory is not absolute, convert it to an
        # absolute path that it can be compared to the outcome of the
        # git.Repo.
        self.__dirs = {}
        self.__repo_base_dir = None
        self.__repo = None
        self.__setup_directories(cfg)
Ejemplo n.º 14
0
    def __init__(self, config):
        """Sets up Import for use."""
        tracer.info("called")
        self.__plugin_manager = extension.ExtensionManager(
            namespace="rmtoo.imports.plugin", invoke_on_load=False)

        assert config  # we need a configuration
        if "import" in config:
            self._config = config["import"]
        else:
            self._config = self.DEFAULT_CONFIG
        self._cfg = Cfg(self._config)

        self._input_dir = {"requirements_dirs": None, "topics_dirs": None}
        self._extract_input_dir(config)

        self._import_obj = []
        self._set_run_modules()
        tracer.debug("Finished.")
Ejemplo n.º 15
0
def create_parameters():
    return Cfg(), {}