コード例 #1
0
def slash_list_plugins(args, report_stream=sys.stdout):
    parser = _get_parser()
    parsed_args = parser.parse_args(args)

    _print = Printer(report_stream,
                     force_color=parsed_args.force_color,
                     enable_color=parsed_args.enable_color)

    site.load()

    active = manager.get_future_active_plugins()

    for plugin in sorted(
            manager.get_installed_plugins(include_internals=False).values(),
            key=lambda p: p.get_name()):
        name = plugin.get_name()
        _print(_title_style(name), end=' ')
        if name in active:
            _print(
                _enabled_style(
                    'active (use --without-{} to deactivate'.format(name)))
        else:
            _print(
                _disabled_style(
                    'inactive (use --with-{} to activate)'.format(name)))
        if plugin.__doc__:
            for line in plugin.__doc__.splitlines():
                if line.strip():
                    _print('\t', line.strip())

    return 0
コード例 #2
0
def test_slash_list_plugins(report_stream):
    slash_list_plugins([], report_stream=report_stream)
    output = report_stream.getvalue()
    assert output
    installed = manager.get_installed_plugins()
    for plugin_name in installed:
        assert plugin_name in output
コード例 #3
0
def test_slash_list_plugins(report_stream):
    slash_list_plugins([], report_stream=report_stream)
    output = report_stream.getvalue()
    assert output
    installed = manager.get_installed_plugins()
    for plugin_name in installed:
        assert plugin_name in output
        activate_flag = "--with-{}".format(plugin_name.replace(' ', '-'))
        assert activate_flag in output
コード例 #4
0
def test_slash_list_plugins_for_internal_plugins(report_stream):
    internal_plugin = InternalPlugin()
    manager.install(internal_plugin, is_internal=True)
    slash_list_plugins([], report_stream=report_stream)
    output = report_stream.getvalue()
    assert output

    assert internal_plugin.get_name() in manager.get_installed_plugins()
    assert internal_plugin.get_name() not in output
    assert '--internal-plugin-option' not in output