def test_find_plugins_in_packages_on_the_plugin_path(self):

        plugin_manager = PackagePluginManager(plugin_path=[self.plugins_dir])
        ids = [plugin.id for plugin in plugin_manager]

        self.assertEqual(len(ids), 3)
        self.assertIn("banana", ids)
        self.assertIn("orange", ids)
        self.assertIn("pear", ids)
Exemple #2
0
    def test_ignore_plugins_matching_a_wildcard_in_the_exclude_list(self):

        # Note that the items in the list use the 'fnmatch' syntax for matching
        # plugins Ids.
        exclude = ["*r*"]

        plugin_manager = PackagePluginManager(plugin_path=[self.plugins_dir],
                                              exclude=exclude)

        # The Ids of the plugins that we expect the plugin manager to find.
        expected = ["banana"]

        # Make sure the plugin manager found only the required plugins and that
        # it starts and stops them correctly..
        self._test_start_and_stop(plugin_manager, expected)
    def test_reflect_changes_to_the_plugin_path(self):
        plugin_manager = PackagePluginManager()
        ids = [plugin.id for plugin in plugin_manager]
        self.assertEqual(len(ids), 0)

        plugin_manager.plugin_path.append(self.plugins_dir)
        ids = [plugin.id for plugin in plugin_manager]
        self.assertEqual(len(ids), 3)
        self.assertIn("banana", ids)
        self.assertIn("orange", ids)
        self.assertIn("pear", ids)

        del plugin_manager.plugin_path[0]
        ids = [plugin.id for plugin in plugin_manager]
        self.assertEqual(len(ids), 0)
Exemple #4
0
    def test_only_find_plugins_whose_ids_are_in_the_include_list(self):

        # Note that the items in the list use the 'fnmatch' syntax for matching
        # plugins Ids.
        include = ["orange", "pear"]

        plugin_manager = PackagePluginManager(plugin_path=[self.plugins_dir],
                                              include=include)

        # The Ids of the plugins that we expect the plugin manager to find.
        expected = ["orange", "pear"]

        # Make sure the plugin manager found only the required plugins and that
        # it starts and stops them correctly..
        self._test_start_and_stop(plugin_manager, expected)