def test_mailman_command_without_subcommand_prints_help(self, mock): # Issue #137: Running `mailman` without a subcommand raises an # AttributeError. result = self._command.invoke(main) lines = result.output.splitlines() # "main" instead of "mailman" because of the way the click runner # works. It does actually show the correct program when run from the # command line. self.assertEqual(lines[0], 'Usage: main [OPTIONS] COMMAND [ARGS]...') # The help output includes a list of subcommands, in sorted order. commands = {} add_components('commands', ICLISubCommand, commands) help_commands = list(line.split()[0].strip() for line in lines[-len(commands):]) self.assertEqual(sorted(commands), help_commands)
def initialize(): """Initialize the pipelines.""" # Find all handlers in the registered plugins. add_components('handlers', IHandler, config.handlers) # Set up some pipelines. add_components('pipelines', IPipeline, config.pipelines)
def populate(self): self._styles.clear() add_components('styles', IStyle, self._styles)
def initialize(): """Set up chains, both built-in and from the database.""" add_components('chains', IChain, config.chains)
def _load(self): # Load commands lazily as commands in plugins can only be found after # the configuration file is loaded. if not self._loaded: add_components('commands', ICLISubCommand, self._commands) self._loaded = True
def initialize(): """Initialize the email commands.""" add_components('commands', IEmailCommand, config.commands)
def initialize(): """Find and register all rules in all plugins.""" # Find rules in plugins. add_components('rules', IRule, config.rules)