Exemplo n.º 1
0
def test_find_config_files(datadir):
    from hookman.hookman_utils import find_config_files
    config_files = find_config_files(datadir)
    assert len(config_files) == 1

    config_files = find_config_files([datadir / 'non_existing_folder'])
    assert len(config_files) == 0
Exemplo n.º 2
0
def test_find_config_files(datadir):
    from hookman.hookman_utils import find_config_files

    config_files = find_config_files(datadir)
    assert len(config_files) == 2

    config_files = find_config_files(datadir, ignored_sub_dir_names=["fizzbuzz"])
    assert len(config_files) == 2

    config_files = find_config_files(datadir, ignored_sub_dir_names=["foo"])
    assert len(config_files) == 1

    config_files = find_config_files(datadir, ignored_sub_dir_names=["foo", "bar"])
    assert len(config_files) == 0

    config_files = find_config_files([datadir / "non_existing_folder"])
    assert len(config_files) == 0
Exemplo n.º 3
0
    def get_plugins_available(
        self,
        ignored_plugins: Sequence[str] = ()) -> Optional[List[PluginInfo]]:
        """
        Return a list of :ref:`plugin-info-api-section` that are available on ``plugins_dirs``

        Optionally you can pass a list of plugins that should be ignored.

        The :ref:`plugin-info-api-section` is a object that holds all information related to the plugin.
        """
        plugin_config_files = hookman_utils.find_config_files(
            self.plugins_dirs)

        plugins_available = [
            PluginInfo(plugin_file, self.hooks_available)
            for plugin_file in plugin_config_files
        ]
        return [
            plugin_info for plugin_info in plugins_available
            if plugin_info.name not in ignored_plugins
        ]