def test_tool_matches(): """ Test the tool_matches function """ instance = PluginHelper() matches = instance.tool_matches(tools=[]) assert matches == []
def _build_tools(self, status): """ Create list of tools, paths, and versions to be built and sends them to build_manifest Args: status (tuple(bool, str)): Returns: response (tuple(bool, str)): If True, then the function performed as expected and the str is a string """ response = (True, None) # TODO implement features: wild, remove_old, disable_old, limit_groups # check result of clone, ensure successful or that it already exists if status: response = self.p_helper.checkout(branch=self.branch, version=self.version) if response[0]: search_groups = None if self.core: search_groups = 'core' matches = [] if self.tools is None and self.overrides is None: # get all tools matches = self.p_helper.available_tools( self.path, version=self.version, groups=search_groups) elif self.tools is None: # there's only something in overrides # grab all the tools then apply overrides matches = self.p_helper.available_tools( self.path, version=self.version, groups=search_groups) # !! TODO apply overrides to matches elif self.overrides is None: # there's only something in tools # only grab the tools specified matches = PluginHelper.tool_matches(tools=self.tools, version=self.version) else: # both tools and overrides were specified # grab only the tools specified, with the overrides applied o_matches = PluginHelper.tool_matches(tools=self.tools, version=self.version) matches = o_matches for override in self.overrides: override_t = None if override[0] == '.': override_t = ('', override[1]) else: override_t = override for match in o_matches: if override_t[0] == match[0]: matches.remove(match) matches.append(override_t) if len(matches) > 0: self._build_manifest(matches) else: response = (False, status) return response