def compatibility(self, catalog_id, repo_id, plugin_name): """ Checks the compatibility of a plugin. :param str catalog_id: The catalog id associated with the plugin. :param str repo_id: The repository id associated with the plugin. :param str plugin_name: The name of the plugin. :return: Tuple of packages and if the requirements are met. :rtype: tuple """ plugin = self.get_collection(catalog_id, repo_id)[plugin_name] return plugins.Requirements(plugin['requirements']).compatibility
def is_compatible(self, catalog_id, repo_id, plugin_name): """ Checks the compatibility of a plugin. :param catalog_id: The catalog id associated with the plugin. :param repo_id: The repository id associated with the plugin. :param plugin_name: The name of the plugin. :return: Whether or not it is compatible. :rtype: bool """ plugin = self.get_collection(catalog_id, repo_id)[plugin_name] return plugins.Requirements(plugin['requirements']).is_compatible
def test_empty_requirements(self): requirements = plugins.Requirements({}) self.assertTrue(requirements.is_compatible, 'no requirements means compatible')
def _test_requirement(self, requirement, case_true, case_false): requirements = plugins.Requirements([(requirement, case_true)]) self.assertTrue(requirements.is_compatible) requirements = plugins.Requirements([(requirement, case_false)]) self.assertFalse(requirements.is_compatible)