Пример #1
0
 def get_result_locations(self):
     rl = []
     for k, v in self.ecf.iteritems():
         if type(v) is not dict:
             continue
         te = TestEntry(k, v, None)
         res_loc = te.get_results_location()
         # no need to repeat the location
         if res_loc not in rl:
             rl.append(res_loc)
     return rl
Пример #2
0
 def get_result_locations(self):
     rl = []
     for k, v in self.ecf.iteritems():
         if not isinstance(v, dict):
             continue
         te = TestEntry(k, v, None)
         res_loc = te.get_results_location()
         # no need to repeat the location
         if res_loc not in rl:
             rl.append(res_loc)
     return rl
Пример #3
0
    def create_effective_config_file(self):
        """
        Return the complete test suite file to be used for this test
        after it is folded in with the default configuration
        """

        # get a copy of the default configuration for a test 
        dk, default_config = self.default_config_doc.items()[0]

        # then, for each new test entry (stanza) in the user_config_doc
        # merge with the default entry (overriding the defaults)
        new_dict = {}
        for test_id, v in self.user_config_doc.items():
            # only use "good" entries
            if type(v) is dict:
                if not TestEntry.check_valid(v):
                    print ", skipping stanza (%s) due to invalid entry" % test_id
                    continue
            tmp_config = default_config.copy()

            # merge the user dictionary with the default configuration. Tried
            # other dict methods ( "+", chain, update) and these did not work with nested dict.
            new_dict[test_id] = merge(tmp_config, self.user_config_doc[test_id])

        return new_dict
Пример #4
0
    def create_effective_config_file(self, override_cf="", default_cf=""):
        """
        Return the complete test suite file to be used for this test
        after it is folded in with the default configuration
        """

        if override_cf == "":
            override_cf=self.user_config_doc
        else:
            override_cf=self.load_config_file( override_cf )

        if default_cf == "":
            default_cf=self.default_config_doc
        else:
            default_cf=self.load_config_file( default_cf )

        # get a copy of the default configuration for a test 
        _, default_config = default_cf.items()[0]

        # then, for each new test entry (stanza) in the user_config_doc
        # merge with the default entry (overriding the defaults)
        new_dict = {}
        for test_id, v in override_cf.items():
            # only use "good" entries
            if isinstance(v, dict):
                if not TestEntry.check_valid(v):
                    print ", skipping stanza (%s) due to invalid entry" % test_id
                    continue
            tmp_config = default_config.copy()

            # merge the user dictionary with the default configuration. Tried
            # other dict methods ( "+", chain, update) and these did not work with nested dict.
            new_dict[test_id] = merge(tmp_config, override_cf[test_id])

        return new_dict