def find_plugins(self): # type: () -> None """Find and load the plugins for this application. If :attr:`check_plugins`, or :attr:`formatting_plugins` are ``None`` then this method will update them with the appropriate plugin manager instance. Given the expense of finding plugins (via :mod:`entrypoints`) we want this to be idempotent and so only update those attributes if they are ``None``. """ if self.local_plugins is None: self.local_plugins = config.get_local_plugins( self.config_finder, self.prelim_opts.config, self.prelim_opts.isolated) sys.path.extend(self.local_plugins.paths) if self.check_plugins is None: self.check_plugins = plugin_manager.Checkers( self.local_plugins.extension) if self.formatting_plugins is None: self.formatting_plugins = plugin_manager.ReportFormatters( self.local_plugins.report) self.check_plugins.load_plugins() self.formatting_plugins.load_plugins()
def find_plugins(self, config_file, ignore_config_files): # type: (Optional[str], bool) -> None """Find and load the plugins for this application. If :attr:`check_plugins`, or :attr:`formatting_plugins` are ``None`` then this method will update them with the appropriate plugin manager instance. Given the expense of finding plugins (via :mod:`entrypoints`) we want this to be idempotent and so only update those attributes if they are ``None``. :param str config_file: The optional configuraiton file to override all other configuration files (i.e., the --config option). :param bool ignore_config_files: Determine whether to parse configuration files or not. (i.e., the --isolated option). """ if self.local_plugins is None: self.local_plugins = config.get_local_plugins( self.config_finder, config_file, ignore_config_files) sys.path.extend(self.local_plugins.paths) if self.check_plugins is None: self.check_plugins = plugin_manager.Checkers( self.local_plugins.extension) if self.formatting_plugins is None: self.formatting_plugins = plugin_manager.ReportFormatters( self.local_plugins.report) self.check_plugins.load_plugins() self.formatting_plugins.load_plugins()
def find_plugins(self, config_finder: config.ConfigFileFinder) -> None: """Find and load the plugins for this application. Set the :attr:`check_plugins` and :attr:`formatting_plugins` attributes based on the discovered plugins found. :param config.ConfigFileFinder config_finder: The finder for finding and reading configuration files. """ local_plugins = config.get_local_plugins(config_finder) sys.path.extend(local_plugins.paths) self.check_plugins = plugin_manager.Checkers(local_plugins.extension) self.formatting_plugins = plugin_manager.ReportFormatters( local_plugins.report) self.check_plugins.load_plugins() self.formatting_plugins.load_plugins()
def find_plugins(self): # type: () -> NoneType """Find and load the plugins for this application. If :attr:`check_plugins`, :attr:`listening_plugins`, or :attr:`formatting_plugins` are ``None`` then this method will update them with the appropriate plugin manager instance. Given the expense of finding plugins (via :mod:`pkg_resources`) we want this to be idempotent and so only update those attributes if they are ``None``. """ if self.check_plugins is None: self.check_plugins = plugin_manager.Checkers() if self.listening_plugins is None: self.listening_plugins = plugin_manager.Listeners() if self.formatting_plugins is None: self.formatting_plugins = plugin_manager.ReportFormatters() self.check_plugins.load_plugins() self.listening_plugins.load_plugins() self.formatting_plugins.load_plugins()